From 0533f9dddcd72b2e810d30be441934fee55eccf7 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Thu, 22 Jan 2015 21:14:06 -0600 Subject: don't lose erl_opts when compiling for tests --- src/rebar_prv_common_test.erl | 4 ++-- src/rebar_prv_eunit.erl | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl index 9e17f38..5de1618 100644 --- a/src/rebar_prv_common_test.erl +++ b/src/rebar_prv_common_test.erl @@ -295,8 +295,8 @@ add_test_dir(Opts, InDirs) -> %% if no src_dirs are set we have to specify `src` or it won't %% be built case proplists:append_values(src_dirs, Opts) of - [] -> [{src_dirs, ["src", "test"|InDirs]}]; - _ -> [{src_dirs, ["test"|InDirs]}] + [] -> [{src_dirs, ["src", "test" | InDirs]} | Opts]; + _ -> [{src_dirs, ["test" | InDirs]} | Opts] end. first_files(State) -> diff --git a/src/rebar_prv_eunit.erl b/src/rebar_prv_eunit.erl index a434fad..13d00b9 100644 --- a/src/rebar_prv_eunit.erl +++ b/src/rebar_prv_eunit.erl @@ -111,9 +111,9 @@ default_test_dir(State) -> test_state(State, TmpDir) -> ErlOpts = rebar_state:get(State, eunit_compile_opts, []) ++ - rebar_utils:erl_opts(State), + rebar_utils:erl_opts(State), ErlOpts1 = [{outdir, TmpDir}] ++ - add_test_dir(ErlOpts), + add_test_dir(ErlOpts), TestOpts = safe_define_test_macro(ErlOpts1), rebar_state:set(State, erl_opts, TestOpts). @@ -121,9 +121,9 @@ add_test_dir(Opts) -> %% if no src_dirs are set we have to specify `src` or it won't %% be built case proplists:append_values(src_dirs, Opts) of - [] -> [{src_dirs, ["src", "test"]}]; - Srcs -> [{src_dirs, ["test"|Srcs]}] - end ++ lists:keydelete(src_dirs, 1, Opts). + [] -> [{src_dirs, ["src", "test"]} | Opts]; + _ -> [{src_dirs, ["test"]} | Opts] + end. safe_define_test_macro(Opts) -> %% defining a compile macro twice results in an exception so -- cgit v1.1