aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorMarc Tiehuis <marctiehuis@gmail.com>2017-10-27 03:00:23 +1300
committerAndrew Kelley <superjoe30@gmail.com>2017-10-26 10:00:23 -0400
commit66636381957f214f1acc22dcea01cb4cd1032649 (patch)
treee74fdbb0df53d8c9d30fc04b3af4fc735732ecab /test/compile_errors.zig
parentf4ca3482f1954eb0bdd0c378206d3a7b8e178f55 (diff)
downloadzig-66636381957f214f1acc22dcea01cb4cd1032649.tar.gz
zig-66636381957f214f1acc22dcea01cb4cd1032649.zip
Improve invalid character error messages (#566)
See #544
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index f3201aea9a..f8e08d599f 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -2252,4 +2252,27 @@ pub fn addCases(cases: &tests.CompileErrorContext) {
\\}
,
".tmp_source.zig:9:13: error: type '&MyType' does not support field access");
+
+ cases.add("carriage return special case",
+ "fn test() -> bool {\r\n" ++
+ " true\r\n" ++
+ "}\r\n"
+ ,
+ ".tmp_source.zig:1:20: error: invalid carriage return, only '\\n' line endings are supported");
+
+ cases.add("non-printable invalid character",
+ "\xff\xfe" ++
+ \\fn test() -> bool {\r
+ \\ true\r
+ \\}
+ ,
+ ".tmp_source.zig:1:1: error: invalid character: '\\xff'");
+
+ cases.add("non-printable invalid character with escape alternative",
+ "fn test() -> bool {\n" ++
+ "\ttrue\n" ++
+ "}\n"
+ ,
+ ".tmp_source.zig:2:1: error: invalid character: '\\t'");
+
}