diff options
author | alisdair sullivan <alisdairsullivan@yahoo.ca> | 2015-03-24 19:14:26 -0700 |
---|---|---|
committer | alisdair sullivan <alisdairsullivan@yahoo.ca> | 2015-03-24 22:01:28 -0700 |
commit | efb859f15acad73cfe2f0510a3d9bcd7958c649f (patch) | |
tree | 802add27d843e4d0e4a2a965192ed52fb378fc3d | |
parent | 044b6580e75a33fed26303eebb5a3648f8b022d3 (diff) |
split function setting test set for clarity
-rw-r--r-- | src/rebar_prv_eunit.erl | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/rebar_prv_eunit.erl b/src/rebar_prv_eunit.erl index b196df8..6872c99 100644 --- a/src/rebar_prv_eunit.erl +++ b/src/rebar_prv_eunit.erl @@ -207,15 +207,17 @@ replace_src_dirs(State) -> StrippedOpts = lists:keydelete(src_dirs, 1, ErlOpts), rebar_state:set(State, erl_opts, [{src_dirs, ["test"]}|StrippedOpts]). -test_set(Apps, Suites) -> test_set(Apps, Suites, []). +test_set(Apps, all) -> set_apps(Apps, []); +test_set(_Apps, Suites) -> set_suites(Suites, []). -test_set([], all, Acc) -> lists:reverse(Acc); -test_set(_, [], Acc) -> lists:reverse(Acc); -test_set([App|Rest], all, Acc) -> +set_apps([], Acc) -> lists:reverse(Acc); +set_apps([App|Rest], Acc) -> AppName = list_to_atom(binary_to_list(rebar_app_info:name(App))), - test_set(Rest, all, [{application, AppName}|Acc]); -test_set(Apps, [Suite|Rest], Acc) -> - test_set(Apps, Rest, [{module, list_to_atom(Suite)}|Acc]). + set_apps(Rest, [{application, AppName}|Acc]). + +set_suites([], Acc) -> lists:reverse(Acc); +set_suites([Suite|Rest], Acc) -> + set_suites(Rest, [{module, list_to_atom(Suite)}|Acc]). resolve_eunit_opts(State) -> {Opts, _} = rebar_state:command_parsed_args(State), @@ -248,3 +250,4 @@ help(app) -> "List of application test suites to run"; help(cover) -> "Generate cover data"; help(suite) -> "List of test suites to run"; help(verbose) -> "Verbose output". + |