diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2016-12-23 14:15:07 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-23 14:15:07 -0500 |
commit | b7a96fa12f9e073f4d67235b54203b113c0b1a08 (patch) | |
tree | 756d043ad4e62edb2cf88149138b974e87d990c5 /src/rebar_prv_eunit.erl | |
parent | 001933f2ab65205a8cde9cd44e5163f9fbb94096 (diff) | |
parent | 5b3526518689eef8765a9303d43408864200b5d8 (diff) |
Merge pull request #1430 from erlang/rebar-1331
refine eunit test detection
Diffstat (limited to 'src/rebar_prv_eunit.erl')
-rw-r--r-- | src/rebar_prv_eunit.erl | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/rebar_prv_eunit.erl b/src/rebar_prv_eunit.erl index a9db12e..7d44137 100644 --- a/src/rebar_prv_eunit.erl +++ b/src/rebar_prv_eunit.erl @@ -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), |