File tree 2 files changed +19
-0
lines changed
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -529,4 +529,13 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
529
529
\\debug: free - len: 5
530
530
\\
531
531
);
532
+
533
+ cases .add ("valid carriage return example" , "const io = @import(\" std\" ).io;\r \n " ++ // Testing CRLF line endings are valid
534
+ "\r \n " ++
535
+ "pub \r fn main() void {\r \n " ++ // Testing isolated carriage return as whitespace is valid
536
+ " const stdout = io.getStdOut().writer();\r \n " ++
537
+ " stdout.print(\\\\ A Multiline\r \n " ++ // testing CRLF at end of multiline string line is valid and normalises to \n in the output
538
+ " \\\\ String\r \n " ++
539
+ " , .{}) catch unreachable;\r \n " ++
540
+ "}\r \n " , "A Multiline\n String" );
532
541
}
Original file line number Diff line number Diff line change @@ -174,6 +174,16 @@ pub fn addCases(ctx: *TestContext) !void {
174
174
});
175
175
}
176
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'" ,
184
+ });
185
+ }
186
+
177
187
{
178
188
const case = ctx .obj ("missing semicolon at EOF" , .{});
179
189
case .addError (
You can’t perform that action at this time.
0 commit comments