summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rebar_state.erl4
-rw-r--r--test/rebar_profiles_SUITE.erl22
-rw-r--r--test/rebar_xref_SUITE.erl2
3 files changed, 22 insertions, 6 deletions
diff --git a/src/rebar_state.erl b/src/rebar_state.erl
index 70aba51..09f1c43 100644
--- a/src/rebar_state.erl
+++ b/src/rebar_state.erl
@@ -207,9 +207,7 @@ merge_opts(Profile, NewOpts, OldOpts) ->
true ->
NewValue;
false ->
- lists:keymerge(1
- ,lists:keysort(1, OldValue)
- ,lists:keysort(1, NewValue))
+ OldValue ++ NewValue
end;
(_Key, NewValue, _OldValue) ->
NewValue
diff --git a/test/rebar_profiles_SUITE.erl b/test/rebar_profiles_SUITE.erl
index 802b772..0b378cb 100644
--- a/test/rebar_profiles_SUITE.erl
+++ b/test/rebar_profiles_SUITE.erl
@@ -6,14 +6,15 @@
end_per_testcase/2,
all/0,
profile_new_key/1,
- profile_merge_keys/1]).
+ profile_merge_keys/1,
+ profile_merges/1]).
-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").
-include_lib("kernel/include/file.hrl").
all() ->
- [profile_new_key, profile_merge_keys].
+ [profile_new_key, profile_merge_keys, profile_merges].
init_per_suite(Config) ->
application:start(meck),
@@ -80,3 +81,20 @@ profile_merge_keys(Config) ->
["as", "ct", "compile"], {ok, [{app, Name}
,{dep, "a", "1.0.0"}
,{dep, "b", "2.0.0"}]}).
+
+profile_merges(_Config) ->
+ RebarConfig = [{test1, [{key1, 1, 2}, key2]},
+ {test2, "hello"},
+ {profiles,
+ [{profile1,
+ [{test1, [{key3, 5}, key1]}]},
+ {profile2, [{test2, "goodbye"}]}]}],
+ State = rebar_state:new(RebarConfig),
+ State1 = rebar_state:apply_profiles(State, [profile1, profile2]),
+
+ %% Combine lists
+ ?assertEqual(lists:sort([key1, key2, {key1, 1, 2}, {key3, 5}]),
+ lists:sort(rebar_state:get(State1, test1))),
+
+ %% Use new value for strings
+ "goodbye" = rebar_state:get(State1, test2).
diff --git a/test/rebar_xref_SUITE.erl b/test/rebar_xref_SUITE.erl
index fde8c8f..067be07 100644
--- a/test/rebar_xref_SUITE.erl
+++ b/test/rebar_xref_SUITE.erl
@@ -57,7 +57,7 @@ end_per_testcase(_, Config) ->
%% we are about to remove the directory and there may be
%% subsequent test cases that error out when the code path tries
%% to include one of these soon-to-be nonexistent directories.
- true = code:del_path(AppDir ++ "/."),
+ code:del_path(AppDir ++ "/."),
true = code:del_path(rebar_dir:ebin_dir()),
file:set_cwd(OrigDir),
ec_file:remove(AppDir, [recursive]),