File tree 2 files changed +22
-3
lines changed
2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -528,4 +528,13 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
528
528
\\debug: free - len: 5
529
529
\\
530
530
);
531
+
532
+ cases .add ("valid carriage return example" , "const io = @import(\" std\" ).io;\r \n " ++ // Testing CRLF line endings are valid
533
+ "\r \n " ++
534
+ "pub \r fn main() void {\r \n " ++ // Testing isolated carriage return as whitespace is valid
535
+ " const stdout = io.getStdOut().writer();\r \n " ++
536
+ " stdout.print(\\ A Multiline\r \n " ++ // testing CRLF at end of multiline string line is valid and normalises to \n in the output
537
+ " \\ String\r \n " ++
538
+ " , .{}) catch unreachable;\r \n " ++
539
+ "}\r \n " , "A Multiline\n String" );
531
540
}
Original file line number Diff line number Diff line change @@ -164,13 +164,23 @@ pub fn addCases(ctx: *TestContext) !void {
164
164
\\ );
165
165
\\}
166
166
, &[_ ][]const u8 {
167
- \\:2:5: error:
167
+ \\:2:5: error:
168
168
\\ hello!
169
169
\\ I'm a multiline error message.
170
170
\\ I hope to be very useful!
171
- \\
171
+ \\
172
172
\\ also I will leave this trailing newline here if you don't mind
173
- \\
173
+ \\
174
+ });
175
+ }
176
+
177
+ {
178
+ const case = ctx .obj ("isolated carriage return in multiline string literal" , .{});
179
+ case .backend = .stage2 ;
180
+
181
+ case .addError ("const foo = \\\\ \t est\r\r rogue carriage return\n ;" , &[_ ][]const u8 {
182
+ ":1:19: error: expected ';' after declaration" ,
183
+ ":1:20: note: invalid byte: '\\ r'" ,
174
184
});
175
185
}
176
186
You can’t perform that action at this time.
0 commit comments