aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/error_SUITE.erl
diff options
context:
space:
mode:
authorChristopher Faulet <[email protected]>2009-12-10 22:21:18 +0100
committerBjörn Gustavsson <[email protected]>2010-01-19 16:23:28 +0100
commit5fdb43ee9adb9081998a2428ba2e5b001c067393 (patch)
treedf6b18ad387be8e0743cfa9ce2b85bbf86b0671b /lib/compiler/test/error_SUITE.erl
parentfb499f15b8b372c8eeb5cf0c4b4af0e109a51ceb (diff)
downloadotp-5fdb43ee9adb9081998a2428ba2e5b001c067393.tar.gz
otp-5fdb43ee9adb9081998a2428ba2e5b001c067393.tar.bz2
otp-5fdb43ee9adb9081998a2428ba2e5b001c067393.zip
compile: add flag warnings_as_errors to treat warnings as errors
With this flag, warnings are treated as errors, like gcc flag '-Werror'.
Diffstat (limited to 'lib/compiler/test/error_SUITE.erl')
-rw-r--r--lib/compiler/test/error_SUITE.erl20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/compiler/test/error_SUITE.erl b/lib/compiler/test/error_SUITE.erl
index 477730c3ac..757e1c5725 100644
--- a/lib/compiler/test/error_SUITE.erl
+++ b/lib/compiler/test/error_SUITE.erl
@@ -21,11 +21,11 @@
-include("test_server.hrl").
-export([all/1,
- head_mismatch_line/1,r11b_binaries/1]).
+ head_mismatch_line/1,r11b_binaries/1,warnings_as_errors/1]).
all(suite) ->
test_lib:recompile(?MODULE),
- [head_mismatch_line,r11b_binaries].
+ [head_mismatch_line,r11b_binaries,warnings_as_errors].
%% Tests that a head mismatch is reported on the correct line (OTP-2125).
head_mismatch_line(Config) when is_list(Config) ->
@@ -73,6 +73,20 @@ r11b_binaries(Config) when is_list(Config) ->
?line [] = run(Config, Ts),
ok.
+warnings_as_errors(Config) when is_list(Config) ->
+ Ts = [{warnings_as_errors,
+ <<"
+ t() ->
+ A = unused,
+ ok.
+ ">>,
+ [warnings_as_errors],
+ {error,
+ [],
+ [{3,erl_lint,{unused_var,'A'}}]} }],
+ ?line [] = run(Config, Ts),
+ ok.
+
run(Config, Tests) ->
F = fun({N,P,Ws,E}, BadL) ->
@@ -104,6 +118,8 @@ run_test(Conf, Test0, Warnings) ->
%% Test result of compilation.
?line Res = case compile:file(File, Opts) of
{error,[{_File,Es}],Ws} ->
+ {error,Es,Ws};
+ {error,Es,[{_File,Ws}]} ->
{error,Es,Ws}
end,
file:delete(File),