diff options
author | Tristan Sloughter <t@crashfast.com> | 2019-04-06 10:06:49 -0600 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2019-04-06 10:06:58 -0600 |
commit | 3e133e1d1cf905e4ef1ea9ca8abe15f674e28484 (patch) | |
tree | bf637be38e21ba1cf190eb9744593585e19f7032 /test | |
parent | df3a88abf76f2096e4fe47f9137ce3dba713d4f6 (diff) |
support dialyzer plt location and prefix in cli args
Diffstat (limited to 'test')
-rw-r--r-- | test/rebar_dialyzer_SUITE.erl | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/test/rebar_dialyzer_SUITE.erl b/test/rebar_dialyzer_SUITE.erl index 6579afb..8577a32 100644 --- a/test/rebar_dialyzer_SUITE.erl +++ b/test/rebar_dialyzer_SUITE.erl @@ -15,7 +15,8 @@ update_app_plt/1, build_release_plt/1, plt_apps_option/1, - exclude_and_extra/1]). + exclude_and_extra/1, + cli_args/1]). -include_lib("common_test/include/ct.hrl"). -include_lib("eunit/include/eunit.hrl"). @@ -58,7 +59,7 @@ all() -> groups() -> [{empty, [empty_base_plt, empty_app_plt, empty_app_succ_typings]}, - {build_and_check, [build_release_plt, plt_apps_option, exclude_and_extra]}, + {build_and_check, [cli_args, build_release_plt, plt_apps_option, exclude_and_extra]}, {update, [update_base_plt, update_app_plt]}]. empty_base_plt(Config) -> @@ -309,6 +310,42 @@ exclude_and_extra(Config) -> {ok, PltFiles} = plt_files(Plt), ?assertEqual(Pair, PltFiles). +cli_args(Config) -> + AppDir = ?config(apps, Config), + [{dialyzer, Opts}] = ?config(rebar_config, Config), + BasePlt = ?config(base_plt, Config), + Plt = ?config(plt, Config), + + {value, {_, Prefix}, Opts1} = lists:keytake(plt_prefix, 1, Opts), + {value, {_, BasePrefix}, Opts2} = lists:keytake(base_plt_prefix, 1, Opts1), + {value, {_, Location}, Opts3} = lists:keytake(plt_location, 1, Opts2), + {value, {_, BasePltLocation}, Opts4} = lists:keytake(base_plt_location, 1, Opts3), + RebarConfig = [{dialyzer, Opts4}], + + Name1 = rebar_test_utils:create_random_name("relapp1_"), + Vsn1 = rebar_test_utils:create_random_vsn(), + rebar_test_utils:create_app(filename:join([AppDir,"apps",Name1]), Name1, Vsn1, + [erts]), + Name2 = rebar_test_utils:create_random_name("relapp2_"), + Vsn2 = rebar_test_utils:create_random_vsn(), + rebar_test_utils:create_app(filename:join([AppDir,"apps",Name2]), Name2, Vsn2, + [erts, ec_cnv:to_atom(Name1)]), + + rebar_test_utils:run_and_check(Config, RebarConfig, ["dialyzer", + "--plt-location=" ++ Location, + "--base-plt-location=" ++ BasePltLocation, + "--plt-prefix=" ++ Prefix, + "--base-plt-prefix=" ++ BasePrefix], + {ok, [{app, Name1}, {app, Name2}]}), + + ErtsFiles = erts_files(), + + {ok, BasePltFiles} = plt_files(BasePlt), + ?assertEqual(ErtsFiles, BasePltFiles), + + {ok, PltFiles} = plt_files(Plt), + ?assertEqual(ErtsFiles, PltFiles). + %% Helpers erts_files() -> |