Skip to content

Commit

Permalink
sort-as: show issue more clearly
Browse files Browse the repository at this point in the history
  • Loading branch information
fenollp committed Feb 23, 2018
1 parent 0f7e6c3 commit 4ad1db9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/rebar_state.erl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
allow_provider_overrides/1, allow_provider_overrides/2
]).

-ifdef(TEST).
-export([deduplicate/1]).
-endif.

-include("rebar.hrl").
-include_lib("providers/include/providers.hrl").

Expand Down
19 changes: 16 additions & 3 deletions test/rebar_profiles_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
test_profile_erl_opts_order_4/1,
test_profile_erl_opts_order_5/1,
test_erl_opts_debug_info/1,
first_files_exception/1]).
first_files_exception/1,
deduplication_stability/1]).

-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").
Expand All @@ -52,7 +53,8 @@ all() ->
test_profile_erl_opts_order_4,
test_profile_erl_opts_order_5,
test_erl_opts_debug_info,
first_files_exception].
first_files_exception,
deduplication_stability].

init_per_suite(Config) ->
application:start(meck),
Expand Down Expand Up @@ -133,7 +135,7 @@ profile_merge_umbrella_keys(Config) ->
{profiles,
[{ct,
[{vals, [{a,1},{b,2}]}]}]}],

SubRebarConfig = [{vals, []},
{profiles, [{ct, [{vals, [{c,1}]}]}]}],

Expand Down Expand Up @@ -546,6 +548,17 @@ first_files_exception(_Config) ->
?assertEqual(["c","a","b","a","e"], rebar_state:get(State1, mib_first_files)),
ok.

deduplication_stability(_Config) ->
?assertEqual([default,all_deps_test], rebar_state:deduplicate([default,all_deps_test])),
?assertEqual([default,profile1,profile2], rebar_state:deduplicate([default,profile1,profile2])),
?assertEqual([default,bar,foo], rebar_state:deduplicate([default,bar,foo,bar])), %% master wants [default,foo,bar]
?assertEqual([default,test,bar], rebar_state:deduplicate([default,test,bar])),
?assertEqual([default,test,bar], rebar_state:deduplicate([default,test,bar,test])),
?assertEqual([default,profile1], rebar_state:deduplicate([default,profile1,profile1,profile1])),
?assertEqual([default,a,b,c,d,e], rebar_state:deduplicate([default,a,b,c,d,e,a,e,b])),
?assertEqual([default,test], rebar_state:deduplicate([default,test])),
ok.

get_compiled_profile_erl_opts(Profiles, Config) ->
AppDir = ?config(apps, Config),
PStrs = [atom_to_list(P) || P <- Profiles],
Expand Down

0 comments on commit 4ad1db9

Please sign in to comment.