summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Gustafsson <fredrik@erlang.org>2013-09-10 09:37:09 +0200
committerFredrik Gustafsson <fredrik@erlang.org>2013-09-10 13:53:01 +0200
commitb7e511364e3e7d05febb081dc170c413d45be666 (patch)
tree266be25f83cdfd93e08264b014a371b72ed92614
parentee55ee98e89fc2cf6bb6d7e4b596507c3b2d9ffb (diff)
downloaderlang-b7e511364e3e7d05febb081dc170c413d45be666.tar.gz
parsetools: added testcase for unicode
-rw-r--r--lib/parsetools/test/leex_SUITE.erl24
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/parsetools/test/leex_SUITE.erl b/lib/parsetools/test/leex_SUITE.erl
index 7cbc72accb..ff49c853f6 100644
--- a/lib/parsetools/test/leex_SUITE.erl
+++ b/lib/parsetools/test/leex_SUITE.erl
@@ -45,7 +45,7 @@
pt/1, man/1, ex/1, ex2/1, not_yet/1,
- otp_10302/1, otp_11286/1]).
+ otp_10302/1, otp_11286/1, unicode/1]).
% Default timetrap timeout (set in init_per_testcase).
-define(default_timeout, ?t:minutes(1)).
@@ -66,7 +66,7 @@ all() ->
groups() ->
[{checks, [], [file, compile, syntax]},
- {examples, [], [pt, man, ex, ex2, not_yet]},
+ {examples, [], [pt, man, ex, ex2, not_yet, unicode]},
{tickets, [], [otp_10302, otp_11286]}].
init_per_suite(Config) ->
@@ -401,6 +401,24 @@ pt(Config) when is_list(Config) ->
?line run(Config, Ts),
ok.
+unicode(suite) ->
+ [];
+unicode(Config) when is_list(Config) ->
+ Ts = [{unicode_1,
+ <<"%% -*- coding: utf-8 -*-\n"
+ "Definitions.\n"
+ "RTLarrow = (←)\n"
+ "Rules.\n"
+ "{RTLarrow} : {token,{'<-',TokenLine}}.\n"
+ "Erlang code.\n"
+ "-export([t/0]).\n"
+ "t() -> {ok, [{'<-', 1}], 1} = string(\"←\"), ok.">>,
+ default,
+ ok}],
+
+ ?line run(Config, Ts),
+ ok.
+
man(doc) ->
"Examples from the manpage.";
man(suite) -> [];
@@ -1076,7 +1094,7 @@ run_test(Config, Def, Pre) ->
XrlFile = filename:join(DataDir, DefFile),
ErlFile = filename:join(DataDir, Filename),
Opts = [return, warn_unused_vars,{outdir,DataDir}],
- ok = file:write_file(XrlFile, Def),
+ ok = file:write_file(XrlFile, Def, [{encoding, unicode}]),
LOpts = [return, {report, false} |
case Pre of
default ->