| ... | ... | @@ -200,24 +200,20 @@ pub const TestContext = struct { |
| 200 | 200 | var array = std.ArrayList(ErrorMsg).init(ctx.zir_error_cases.allocator); |
| 201 | 201 | for (expected_errors) |e| { |
| 202 | 202 | var cur = e; |
| 203 | | const err = cur[0..7]; |
| 204 | | if (!std.mem.eql(u8, err, "error: ")) { |
| 205 | | std.debug.panic("Only error messages are currently supported, received {}\n", .{e}); |
| 206 | | } |
| 207 | | cur = cur[7..]; |
| 208 | 203 | var line_index = std.mem.indexOf(u8, cur, ":"); |
| 209 | 204 | if (line_index == null) { |
| 210 | | std.debug.panic("Invalid test: error must be specified as 'error: line:column: msg', found '{}'", .{e}); |
| 205 | std.debug.panic("Invalid test: error must be specified as 'line:column: error: msg', found '{}'", .{e}); |
| 211 | 206 | } |
| 212 | 207 | const line = std.fmt.parseInt(u32, cur[0..line_index.?], 10) catch @panic("Unable to parse line number"); |
| 213 | 208 | cur = cur[line_index.? + 1 ..]; |
| 214 | 209 | const column_index = std.mem.indexOf(u8, cur, ":"); |
| 215 | 210 | if (column_index == null) { |
| 216 | | std.debug.panic("Invalid test: error must be specified as 'error: line:column: msg', found '{}'", .{e}); |
| 211 | std.debug.panic("Invalid test: error must be specified as 'line:column: error: msg', found '{}'", .{e}); |
| 217 | 212 | } |
| 218 | 213 | const column = std.fmt.parseInt(u32, cur[0..column_index.?], 10) catch @panic("Unable to parse column number"); |
| 219 | | std.debug.assert(cur[column_index.? + 1] == ' '); |
| 220 | | const msg = cur[column_index.? + 2 ..]; |
| 214 | cur = cur[column_index.? + 2 ..]; |
| 215 | std.debug.assert(std.mem.eql(u8, cur[0..7], "error: ")); |
| 216 | const msg = cur[7..]; |
| 221 | 217 | |
| 222 | 218 | if (line == 0 or column == 0) { |
| 223 | 219 | @panic("Invalid test: error line and column must be specified starting at one!"); |