diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2015-03-22 21:39:36 -0400 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2015-03-22 21:39:36 -0400 |
commit | 2d430bf3e2766ad98e9a859a0de246abfd4eee3e (patch) | |
tree | a9ce610d685fd630a1916d54f8c2171544e7f62e /test | |
parent | cafd62e10185e2fc05490c387484dfdb2b615803 (diff) |
Preserve profile order on mergeable tuple/opts
Rather than using the stdlib lists:umerge, we expand it to allow fuzzy
matching on tuples vs. vals (`key` vs. `{key,val}`) with an overriden
sort order so that two tuples or values comparing equal get a priority
on the newest profile.
This is a partial fix for #287 -- this current patch should be followed
by a relx update to take options in order (as if they were a proplist)
to complete it.
Diffstat (limited to 'test')
-rw-r--r-- | test/rebar_profiles_SUITE.erl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/rebar_profiles_SUITE.erl b/test/rebar_profiles_SUITE.erl index a4f926e..ab37255 100644 --- a/test/rebar_profiles_SUITE.erl +++ b/test/rebar_profiles_SUITE.erl @@ -100,12 +100,17 @@ profile_merges(_Config) -> {test2, "hello"}, {test3, [key3]}, {test4, "oldvalue"}, + {test5, [{key5, true}]}, + {test6, [{key6, false}]}, {profiles, [{profile1, [{test1, [{key3, 5}, key1]}]}, {profile2, [{test2, "goodbye"}, {test3, []}, - {test4, []}]}]}], + {test4, []}, + {test5, [{key5, false}]}, + {test6, [{key6, true}]} + ]}]}], State = rebar_state:new(RebarConfig), State1 = rebar_state:apply_profiles(State, [profile1, profile2]), @@ -118,7 +123,9 @@ profile_merges(_Config) -> %% Check that a newvalue of []/"" doesn't override non-string oldvalues [key3] = rebar_state:get(State1, test3), - [] = rebar_state:get(State1, test4). + [] = rebar_state:get(State1, test4), + [{key5, false}, {key5, true}] = rebar_state:get(State1, test5), + [{key6, true}, {key6, false}] = rebar_state:get(State1, test6). add_to_profile(_Config) -> RebarConfig = [{foo, true}, {bar, false}], |