aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test
diff options
context:
space:
mode:
Diffstat (limited to 'lib/asn1/test')
-rw-r--r--lib/asn1/test/asn1_SUITE.erl.src4
-rw-r--r--lib/asn1/test/test_compile_options.erl41
2 files changed, 42 insertions, 3 deletions
diff --git a/lib/asn1/test/asn1_SUITE.erl.src b/lib/asn1/test/asn1_SUITE.erl.src
index 582ccd877c..e7f93a4053 100644
--- a/lib/asn1/test/asn1_SUITE.erl.src
+++ b/lib/asn1/test/asn1_SUITE.erl.src
@@ -2236,8 +2236,10 @@ test_compile_options(Config) ->
?line ok = test_compile_options:path(Config),
?line ok = test_compile_options:noobj(Config),
?line ok = test_compile_options:record_name_prefix(Config),
- ?line ok = test_compile_options:verbose(Config)
+ ?line ok = test_compile_options:verbose(Config),
+ ?line ok = test_compile_options:warnings_as_errors(Config)
end.
+
testDoubleEllipses(suite) -> [];
testDoubleEllipses(Config) ->
?line testDoubleEllipses:compile(Config,?BER,[]),
diff --git a/lib/asn1/test/test_compile_options.erl b/lib/asn1/test/test_compile_options.erl
index 5e027cdedb..a622d5bfd2 100644
--- a/lib/asn1/test/test_compile_options.erl
+++ b/lib/asn1/test/test_compile_options.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2005-2011. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -24,7 +24,7 @@
-export([wrong_path/1,comp/2,path/1,ticket_6143/1,noobj/1,
- record_name_prefix/1,verbose/1]).
+ record_name_prefix/1,verbose/1,warnings_as_errors/1]).
%% OTP-5689
wrong_path(Config) ->
@@ -141,6 +141,43 @@ verbose(Config) when is_list(Config) ->
?line [] = test_server:capture_get(),
ok.
+warnings_as_errors(Config) when is_list(Config) ->
+ PrivDir = ?config(priv_dir,Config),
+ Asn1File = filename:join([PrivDir,"WERROR.asn1"]),
+ OutFile = filename:join([PrivDir,"WERROR.erl"]),
+ Opts = [{outdir,PrivDir},noobj,verbose],
+
+ %% Generate WERR.asn to emit warning
+ %% Warning: Wrong format of type/value
+ %% false/{'Externalvaluereference',_,'WERR',noInvokeId}
+ Warn = <<"WERROR DEFINITIONS IMPLICIT TAGS ::=\n"
+ "\n"
+ "BEGIN\n"
+ "\n"
+ "InvokeId ::= CHOICE\n"
+ "{\n"
+ " present INTEGER,\n"
+ " absent NULL\n"
+ "}\n"
+ "\n"
+ "noInvokeId InvokeId ::= absent:NULL\n"
+ "\n"
+ "NoInvokeId InvokeId ::= {noInvokeId}\n"
+ "\n"
+ "END -- end of useful definitions.\n">>,
+ ?line ok = file:write_file(Asn1File, Warn),
+
+ %% Test warnings_as_errors compile
+ ?line false = filelib:is_regular(OutFile),
+ ?line {error, _} = asn1ct:compile(Asn1File, [warnings_as_errors|Opts]),
+ ?line false = filelib:is_regular(OutFile),
+
+ %% Test normal compile
+ ?line ok = asn1ct:compile(Asn1File, Opts),
+ ?line true = filelib:is_regular(OutFile),
+ ?line ok = file:delete(OutFile),
+ ok.
+
outfiles_check(OutDir) ->
outfiles_check(OutDir,outfiles1()).