diff options
-rw-r--r-- | src/rebar_prv_eunit.erl | 6 | ||||
-rw-r--r-- | test/rebar_eunit_SUITE.erl | 24 |
2 files changed, 24 insertions, 6 deletions
diff --git a/src/rebar_prv_eunit.erl b/src/rebar_prv_eunit.erl index 8ac0187..b196df8 100644 --- a/src/rebar_prv_eunit.erl +++ b/src/rebar_prv_eunit.erl @@ -142,10 +142,8 @@ filter_checkouts(Apps) -> filter_checkouts(Apps, []). filter_checkouts([], Acc) -> lists:reverse(Acc); filter_checkouts([App|Rest], Acc) -> - AppDir = filename:absname(rebar_app_info:dir(App)), - CheckoutsDir = filename:absname("_checkouts"), - case lists:prefix(CheckoutsDir, AppDir) of - true -> filter_checkouts(Rest, Acc); + case rebar_app_info:is_checkout(App) of + true -> filter_checkouts(Rest, Acc); false -> filter_checkouts(Rest, [App|Acc]) end. diff --git a/test/rebar_eunit_SUITE.erl b/test/rebar_eunit_SUITE.erl index 33df773..4ec92f2 100644 --- a/test/rebar_eunit_SUITE.erl +++ b/test/rebar_eunit_SUITE.erl @@ -219,6 +219,15 @@ test_single_app_flag(Config) -> Vsn2, [kernel, stdlib]), + BareSuite = io_lib:format("-module(all_tests).\n" + "-compile(export_all).\n" + "-include_lib(\"eunit/include/eunit.hrl\").\n" + "some_test_() -> ?_assert(true).\n" + "define_test_() -> ?_assertEqual(true, ?some_define).\n", []), + FileName = filename:join([AppDir, "test", "all_tests.erl"]), + ok = filelib:ensure_dir(FileName), + ok = ec_file:write(FileName, BareSuite), + RebarConfig = [{erl_opts, [{d, some_define}]}], rebar_test_utils:run_and_check(Config, RebarConfig, @@ -228,7 +237,8 @@ test_single_app_flag(Config) -> Suite1 = list_to_atom("not_a_real_src_" ++ Name1 ++ "_tests"), {module, Suite1} = code:ensure_loaded(Suite1), Suite2 = list_to_atom("not_a_real_src_" ++ Name2 ++ "_tests"), - {error, nofile} = code:ensure_loaded(Suite2). + {error, nofile} = code:ensure_loaded(Suite2), + {error, nofile} = code:ensure_loaded(all_tests). test_multiple_app_flag(Config) -> AppDir = ?config(apps, Config), @@ -246,6 +256,15 @@ test_multiple_app_flag(Config) -> Vsn2, [kernel, stdlib]), + BareSuite = io_lib:format("-module(all_tests).\n" + "-compile(export_all).\n" + "-include_lib(\"eunit/include/eunit.hrl\").\n" + "some_test_() -> ?_assert(true).\n" + "define_test_() -> ?_assertEqual(true, ?some_define).\n", []), + FileName = filename:join([AppDir, "test", "all_tests.erl"]), + ok = filelib:ensure_dir(FileName), + ok = ec_file:write(FileName, BareSuite), + RebarConfig = [{erl_opts, [{d, some_define}]}], rebar_test_utils:run_and_check(Config, RebarConfig, @@ -255,7 +274,8 @@ test_multiple_app_flag(Config) -> Suite1 = list_to_atom("not_a_real_src_" ++ Name1 ++ "_tests"), {module, Suite1} = code:ensure_loaded(Suite1), Suite2 = list_to_atom("not_a_real_src_" ++ Name2 ++ "_tests"), - {module, Suite2} = code:ensure_loaded(Suite2). + {module, Suite2} = code:ensure_loaded(Suite2), + {error, nofile} = code:ensure_loaded(all_tests). test_nonexistent_app_flag(Config) -> AppDir = ?config(apps, Config), |