Compilation: indent multiline error messages properly
Co-authored-by: Veikka Tuominen <git@vexu.eu>
This commit is contained in:
@@ -138,6 +138,42 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
"tmp.zig:2:1: error: invalid character: '\\t'",
|
||||
});
|
||||
|
||||
{
|
||||
const case = ctx.obj("multiline error messages", .{});
|
||||
case.backend = .stage2;
|
||||
|
||||
case.addError(
|
||||
\\comptime {
|
||||
\\ @compileError("hello\nworld");
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
\\:2:5: error: hello
|
||||
\\ world
|
||||
});
|
||||
|
||||
case.addError(
|
||||
\\comptime {
|
||||
\\ @compileError(
|
||||
\\ \\
|
||||
\\ \\hello!
|
||||
\\ \\I'm a multiline error message.
|
||||
\\ \\I hope to be very useful!
|
||||
\\ \\
|
||||
\\ \\also I will leave this trailing newline here if you don't mind
|
||||
\\ \\
|
||||
\\ );
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
\\:2:5: error:
|
||||
\\ hello!
|
||||
\\ I'm a multiline error message.
|
||||
\\ I hope to be very useful!
|
||||
\\
|
||||
\\ also I will leave this trailing newline here if you don't mind
|
||||
\\
|
||||
});
|
||||
}
|
||||
|
||||
// TODO test this in stage2, but we won't even try in stage1
|
||||
//ctx.objErrStage1("inline fn calls itself indirectly",
|
||||
// \\export fn foo() void {
|
||||
|
||||
Reference in New Issue
Block a user