summaryrefslogtreecommitdiff
path: root/src/rebar_prv_eunit.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_prv_eunit.erl')
-rw-r--r--src/rebar_prv_eunit.erl11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/rebar_prv_eunit.erl b/src/rebar_prv_eunit.erl
index 0908ec9..7d44137 100644
--- a/src/rebar_prv_eunit.erl
+++ b/src/rebar_prv_eunit.erl
@@ -18,7 +18,7 @@
%% we need to modify app_info state before compile
-define(DEPS, [lock]).
--define(DEFAULT_TEST_REGEX, "^[^._].*\\.erl\$").
+-define(DEFAULT_TEST_REGEX, "^(?!\\._).*\\.erl\$").
%% ===================================================================
%% Public API
@@ -195,17 +195,18 @@ gather_src([Dir|Rest], Regex, Srcs) ->
gather_src(Rest, Regex, Srcs ++ rebar_utils:find_files(Dir, Regex, true)).
dedupe_tests({AppMods, TestMods}) ->
+ UniqueTestMods = lists:usort(TestMods) -- AppMods,
%% for each modules in TestMods create a test if there is not a module
%% in AppMods that will trigger it
- F = fun(Mod) ->
- M = filename:basename(Mod, ".erl"),
- MatchesTest = fun(Dir) -> filename:basename(Dir, ".erl") ++ "_tests" == M end,
+ F = fun(TestMod) ->
+ M = filename:rootname(filename:basename(TestMod)),
+ MatchesTest = fun(AppMod) -> filename:rootname(filename:basename(AppMod)) ++ "_tests" == M end,
case lists:any(MatchesTest, AppMods) of
false -> {true, {module, list_to_atom(M)}};
true -> false
end
end,
- lists:usort(rebar_utils:filtermap(F, TestMods)).
+ rebar_utils:filtermap(F, UniqueTestMods).
inject_eunit_state(State, {ok, Tests}) ->
Apps = rebar_state:project_apps(State),