aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/warnings_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-03-19 11:51:46 +0100
committerBjörn Gustavsson <[email protected]>2014-03-19 11:51:46 +0100
commit17944ea74120ac831b85d0c3cfe2be419285c6d7 (patch)
tree933fb986a8833cb7e0c42eefd00f3f414bf0c225 /lib/compiler/test/warnings_SUITE.erl
parent539614ad82cfd0ced75e9f43fa76b013d4598d01 (diff)
parentbfe7e45cda6591dc31405ed1be961f079cc541c9 (diff)
downloadotp-17944ea74120ac831b85d0c3cfe2be419285c6d7.tar.gz
otp-17944ea74120ac831b85d0c3cfe2be419285c6d7.tar.bz2
otp-17944ea74120ac831b85d0c3cfe2be419285c6d7.zip
Merge branch 'bjorn/compiler/utf8-warning/OTP-11791'
* bjorn/compiler/utf8-warning/OTP-11791: Don't fail compilation for modules that contain invalid UTF-8 epp: Make it possible to specify a default encoding
Diffstat (limited to 'lib/compiler/test/warnings_SUITE.erl')
-rw-r--r--lib/compiler/test/warnings_SUITE.erl38
1 files changed, 35 insertions, 3 deletions
diff --git a/lib/compiler/test/warnings_SUITE.erl b/lib/compiler/test/warnings_SUITE.erl
index de56a59e12..c3b02819f9 100644
--- a/lib/compiler/test/warnings_SUITE.erl
+++ b/lib/compiler/test/warnings_SUITE.erl
@@ -37,8 +37,9 @@
-export([pattern/1,pattern2/1,pattern3/1,pattern4/1,
guard/1,bad_arith/1,bool_cases/1,bad_apply/1,
- files/1,effect/1,bin_opt_info/1,bin_construction/1, comprehensions/1,
- maps/1,redundant_boolean_clauses/1]).
+ files/1,effect/1,bin_opt_info/1,bin_construction/1,
+ comprehensions/1,maps/1,redundant_boolean_clauses/1,
+ latin1_fallback/1]).
% Default timetrap timeout (set in init_per_testcase).
-define(default_timeout, ?t:minutes(2)).
@@ -63,7 +64,7 @@ groups() ->
[pattern,pattern2,pattern3,pattern4,guard,
bad_arith,bool_cases,bad_apply,files,effect,
bin_opt_info,bin_construction,comprehensions,maps,
- redundant_boolean_clauses]}].
+ redundant_boolean_clauses,latin1_fallback]}].
init_per_suite(Config) ->
Config.
@@ -591,6 +592,37 @@ redundant_boolean_clauses(Config) when is_list(Config) ->
run(Config, Ts),
ok.
+latin1_fallback(Conf) when is_list(Conf) ->
+ DataDir = ?privdir,
+ IncFile = filename:join(DataDir, "include_me.hrl"),
+ file:write_file(IncFile, <<"%% ",246," in include file\n">>),
+ Ts1 = [{latin1_fallback1,
+ %% Test that the compiler fall backs to latin-1 with
+ %% a warning if a file has no encoding and does not
+ %% contain correct UTF-8 sequences.
+ <<"%% Bj",246,"rn
+ t(_) -> \"",246,"\";
+ t(x) -> ok.
+ ">>,
+ [],
+ {warnings,[{1,compile,reparsing_invalid_unicode},
+ {3,sys_core_fold,{nomatch_shadow,2}}]}}],
+ [] = run(Conf, Ts1),
+
+ Ts2 = [{latin1_fallback2,
+ %% Test that the compiler fall backs to latin-1 with
+ %% a warning if a file has no encoding and does not
+ %% contain correct UTF-8 sequences.
+ <<"
+
+ -include(\"include_me.hrl\").
+ ">>,
+ [],
+ {warnings,[{1,compile,reparsing_invalid_unicode}]}
+ }],
+ [] = run(Conf, Ts2),
+ ok.
+
%%%
%%% End of test cases.
%%%