diff options
| author | Noam Preil <pleasantatk@gmail.com> | 2020-06-04 16:12:09 -0400 |
|---|---|---|
| committer | Noam Preil <pleasantatk@gmail.com> | 2020-06-15 20:33:17 -0400 |
| commit | e77fc7fe7e3d6e5e4dc89bbc8fa95e65d4134b9f (patch) | |
| tree | c12eb145645249cf3f4e04655dc15c782c78cc40 /src-self-hosted/test.zig | |
| parent | 6dce317fe39443278ee744e66118c6e9b6023615 (diff) | |
| download | zig-e77fc7fe7e3d6e5e4dc89bbc8fa95e65d4134b9f.tar.gz zig-e77fc7fe7e3d6e5e4dc89bbc8fa95e65d4134b9f.zip | |
Stage2/Testing: Fix error specification
Diffstat (limited to 'src-self-hosted/test.zig')
| -rw-r--r-- | src-self-hosted/test.zig | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src-self-hosted/test.zig b/src-self-hosted/test.zig index feba455758..c0fb52a74d 100644 --- a/src-self-hosted/test.zig +++ b/src-self-hosted/test.zig @@ -200,24 +200,20 @@ pub const TestContext = struct { var array = std.ArrayList(ErrorMsg).init(ctx.zir_error_cases.allocator); for (expected_errors) |e| { var cur = e; - const err = cur[0..7]; - if (!std.mem.eql(u8, err, "error: ")) { - std.debug.panic("Only error messages are currently supported, received {}\n", .{e}); - } - cur = cur[7..]; var line_index = std.mem.indexOf(u8, cur, ":"); if (line_index == null) { - std.debug.panic("Invalid test: error must be specified as 'error: line:column: msg', found '{}'", .{e}); + std.debug.panic("Invalid test: error must be specified as 'line:column: error: msg', found '{}'", .{e}); } const line = std.fmt.parseInt(u32, cur[0..line_index.?], 10) catch @panic("Unable to parse line number"); cur = cur[line_index.? + 1 ..]; const column_index = std.mem.indexOf(u8, cur, ":"); if (column_index == null) { - std.debug.panic("Invalid test: error must be specified as 'error: line:column: msg', found '{}'", .{e}); + std.debug.panic("Invalid test: error must be specified as 'line:column: error: msg', found '{}'", .{e}); } const column = std.fmt.parseInt(u32, cur[0..column_index.?], 10) catch @panic("Unable to parse column number"); - std.debug.assert(cur[column_index.? + 1] == ' '); - const msg = cur[column_index.? + 2 ..]; + cur = cur[column_index.? + 2 ..]; + std.debug.assert(std.mem.eql(u8, cur[0..7], "error: ")); + const msg = cur[7..]; if (line == 0 or column == 0) { @panic("Invalid test: error line and column must be specified starting at one!"); |
