summaryrefslogtreecommitdiff
path: root/src/rebar_prv_eunit.erl
diff options
context:
space:
mode:
authoralisdair sullivan <alisdair.sullivan@askuity.com>2015-09-14 10:19:33 -0700
committeralisdair sullivan <alisdair.sullivan@askuity.com>2015-09-29 15:29:16 -0700
commit9e9c4212ce2c6b109bc1c027745bc2282df7977b (patch)
treeee820cd8b4c47dc64ba36e8ea8346f9bd87ccbf9 /src/rebar_prv_eunit.erl
parenta4e020d1eded872cfc910f5c9cff0a87808f43ce (diff)
drop `eunit_first_files' and `eunit_compile_opts'. that's what
profiles are for
Diffstat (limited to 'src/rebar_prv_eunit.erl')
-rw-r--r--src/rebar_prv_eunit.erl25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/rebar_prv_eunit.erl b/src/rebar_prv_eunit.erl
index b1c78b3..4005098 100644
--- a/src/rebar_prv_eunit.erl
+++ b/src/rebar_prv_eunit.erl
@@ -31,7 +31,7 @@ init(State) ->
{opts, eunit_opts(State)},
{profiles, [test]}]),
State1 = rebar_state:add_provider(State, Provider),
- State2 = rebar_state:add_to_profile(State1, test, test_state(State1)),
+ State2 = rebar_state:add_to_profile(State1, test, test_state()),
{ok, State2}.
-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
@@ -89,28 +89,7 @@ format_error({error, Error}) ->
%% Internal functions
%% ===================================================================
-test_state(State) ->
- ErlOpts = rebar_state:get(State, eunit_compile_opts, []),
- TestOpts = safe_define_test_macro(ErlOpts),
- TestDir = [{extra_src_dirs, ["test"]}],
- first_files(State) ++ [{erl_opts, TestOpts ++ TestDir}].
-
-safe_define_test_macro(Opts) ->
- %% defining a compile macro twice results in an exception so
- %% make sure 'TEST' is only defined once
- case test_defined(Opts) of
- true -> Opts;
- false -> [{d, 'TEST'}] ++ Opts
- end.
-
-test_defined([{d, 'TEST'}|_]) -> true;
-test_defined([{d, 'TEST', true}|_]) -> true;
-test_defined([_|Rest]) -> test_defined(Rest);
-test_defined([]) -> false.
-
-first_files(State) ->
- EUnitFirst = rebar_state:get(State, eunit_first_files, []),
- [{erl_first_files, EUnitFirst}].
+test_state() -> [{extra_src_dirs, ["test"]}, {erl_opts, [{d, 'TEST'}]}].
prepare_tests(State) ->
{RawOpts, _} = rebar_state:command_parsed_args(State),