From f4dafa4628da045db7b21c90406138baccd7b844 Mon Sep 17 00:00:00 2001 From: alisdair sullivan Date: Wed, 7 Jan 2015 18:31:27 -0800 Subject: switch to `lists:ukeymerge` to merge `ct` opts for better behavior in presence of keys defined multiple times --- src/rebar_prv_common_test.erl | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl index 65a09ef..50c7cf0 100644 --- a/src/rebar_prv_common_test.erl +++ b/src/rebar_prv_common_test.erl @@ -275,19 +275,7 @@ resolve_ct_opts(State, Opts) -> %% rebar has seperate input and output directories whereas `common_test` %% uses only a single directory so handle `dir` elsewhere CmdLineOpts = lists:keydelete(dir, 1, Opts), - merge_opts(CTOpts, CmdLineOpts, []). - -%% merge opts by iterating over opts defined in `rebar.config` and checking -%% command line opts to see if opt is also defined there. if so, take that -%% value (dropping the value from `rebar.config`) and continue until there -%% are no more opts defined in `rebar.config` then append remaining command -%% line opts -merge_opts([], CmdLineOpts, Acc) -> [CmdLineOpts] ++ Acc; -merge_opts([{K, V}|Rest], CmdLineOpts, Acc) -> - case lists:keytake(K, 1, CmdLineOpts) of - {K, Override, Rem} -> merge_opts(Rest, Rem, [{K, Override}] ++ Acc); - false -> merge_opts(Rest, CmdLineOpts, [{K, V}] ++ Acc) - end. + lists:ukeymerge(1, lists:ukeysort(1, CmdLineOpts), lists:ukeysort(1, CTOpts)). handle_results([Result]) -> handle_results(Result); -- cgit v1.1