diff options
author | Hans Bolinder <[email protected]> | 2016-10-21 09:18:36 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2016-10-21 09:18:36 +0200 |
commit | b36d72178ed0739d6bf71a8047ae0a026ceb4a64 (patch) | |
tree | 09948ea259bc4ff994d4fb89ded302ba008a9e70 /lib/dialyzer/test | |
parent | 616a4c1d925192b3559ddcad6fcda329ad706dab (diff) | |
parent | 055b1b09537b8900489d28ba37078edd7be57d04 (diff) | |
download | otp-b36d72178ed0739d6bf71a8047ae0a026ceb4a64.tar.gz otp-b36d72178ed0739d6bf71a8047ae0a026ceb4a64.tar.bz2 otp-b36d72178ed0739d6bf71a8047ae0a026ceb4a64.zip |
Merge branch 'maint'
* maint:
dialyzer: Fix error handling of bad -dialyzer() attributes
Diffstat (limited to 'lib/dialyzer/test')
-rw-r--r-- | lib/dialyzer/test/plt_SUITE.erl | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/dialyzer/test/plt_SUITE.erl b/lib/dialyzer/test/plt_SUITE.erl index 6ebe23b54b..460d4e2240 100644 --- a/lib/dialyzer/test/plt_SUITE.erl +++ b/lib/dialyzer/test/plt_SUITE.erl @@ -8,13 +8,15 @@ -export([suite/0, all/0, build_plt/1, beam_tests/1, update_plt/1, local_fun_same_as_callback/1, - remove_plt/1, run_plt_check/1, run_succ_typings/1]). + remove_plt/1, run_plt_check/1, run_succ_typings/1, + bad_dialyzer_attr/1]). suite() -> [{timetrap, ?plt_timeout}]. all() -> [build_plt, beam_tests, update_plt, run_plt_check, - remove_plt, run_succ_typings, local_fun_same_as_callback]. + remove_plt, run_succ_typings, local_fun_same_as_callback, + bad_dialyzer_attr]. build_plt(Config) -> OutDir = ?config(priv_dir, Config), @@ -249,6 +251,30 @@ remove_plt(Config) -> {init_plt, Plt}] ++ Opts), ok. +bad_dialyzer_attr(Config) -> + PrivDir = ?config(priv_dir, Config), + + Prog1 = <<"-module(dial). + -dialyzer({no_return, [undef/0]}).">>, + {ok, Beam1} = compile(Config, Prog1, dial, []), + Plt = filename:join(PrivDir, "bad_attr.plt"), + {dialyzer_error, + "Analysis failed with error:\n" + "Could not scan the following file(s):\n" + " Unknown function undef/0 in line " ++ _} = + (catch run_dialyzer(plt_build, [Beam1], [])), + + Prog2 = <<"-module(dial). + -dialyzer({no_return, [{undef,1,2}]}).">>, + {ok, Beam2} = compile(Config, Prog2, dial, []), + {dialyzer_error, + "Analysis failed with error:\n" + "Could not scan the following file(s):\n" + " Bad function {undef,1,2} in line " ++ _} = + (catch run_dialyzer(plt_build, [Beam2], [])), + + ok. + compile(Config, Prog, Module, CompileOpts) -> Source = lists:concat([Module, ".erl"]), PrivDir = ?config(priv_dir,Config), |