瀏覽代碼

switch to `lists:ukeymerge` to merge `ct` opts for better behavior

in presence of keys defined multiple times
pull/88/head
alisdair sullivan 10 年之前
父節點
當前提交
f4dafa4628
共有 1 個檔案被更改,包括 1 行新增13 行删除
  1. +1
    -13
      src/rebar_prv_common_test.erl

+ 1
- 13
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` %% rebar has seperate input and output directories whereas `common_test`
%% uses only a single directory so handle `dir` elsewhere %% uses only a single directory so handle `dir` elsewhere
CmdLineOpts = lists:keydelete(dir, 1, Opts), 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]) ->
handle_results(Result); handle_results(Result);

Loading…
取消
儲存