aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test/test_compile_options.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/asn1/test/test_compile_options.erl')
-rw-r--r--lib/asn1/test/test_compile_options.erl39
1 files changed, 38 insertions, 1 deletions
diff --git a/lib/asn1/test/test_compile_options.erl b/lib/asn1/test/test_compile_options.erl
index 5e027cdedb..5cb212eddf 100644
--- a/lib/asn1/test/test_compile_options.erl
+++ b/lib/asn1/test/test_compile_options.erl
@@ -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()).