| ... | ... | @@ -364,7 +364,7 @@ const Eval = struct { |
| 364 | 364 | error_bundle.renderToStdErr(color.renderOptions()); |
| 365 | 365 | eval.fatal("update '{s}': more errors than expected", .{update.name}); |
| 366 | 366 | } |
| 367 | | eval.checkOneError(update, error_bundle, expected.errors[expected_idx], false, err_idx); |
| 367 | try eval.checkOneError(update, error_bundle, expected.errors[expected_idx], false, err_idx); |
| 368 | 368 | expected_idx += 1; |
| 369 | 369 | |
| 370 | 370 | for (error_bundle.getNotes(err_idx)) |note_idx| { |
| ... | ... | @@ -373,7 +373,7 @@ const Eval = struct { |
| 373 | 373 | error_bundle.renderToStdErr(color.renderOptions()); |
| 374 | 374 | eval.fatal("update '{s}': more error notes than expected", .{update.name}); |
| 375 | 375 | } |
| 376 | | eval.checkOneError(update, error_bundle, expected.errors[expected_idx], true, note_idx); |
| 376 | try eval.checkOneError(update, error_bundle, expected.errors[expected_idx], true, note_idx); |
| 377 | 377 | expected_idx += 1; |
| 378 | 378 | } |
| 379 | 379 | } |
| ... | ... | @@ -392,13 +392,21 @@ const Eval = struct { |
| 392 | 392 | expected: Case.ExpectedError, |
| 393 | 393 | is_note: bool, |
| 394 | 394 | err_idx: std.zig.ErrorBundle.MessageIndex, |
| 395 | | ) void { |
| 395 | ) Allocator.Error!void { |
| 396 | 396 | const err = eb.getErrorMessage(err_idx); |
| 397 | 397 | if (err.src_loc == .none) @panic("TODO error message with no source location"); |
| 398 | 398 | if (err.count != 1) @panic("TODO error message with count>1"); |
| 399 | 399 | const msg = eb.nullTerminatedString(err.msg); |
| 400 | 400 | const src = eb.getSourceLocation(err.src_loc); |
| 401 | | const filename = eb.nullTerminatedString(src.src_path); |
| 401 | const raw_filename = eb.nullTerminatedString(src.src_path); |
| 402 | |
| 403 | // We need to replace backslashes for consistency between platforms. |
| 404 | const filename = name: { |
| 405 | if (std.mem.indexOfScalar(u8, raw_filename, '\\') == null) break :name raw_filename; |
| 406 | const copied = try eval.arena.dupe(u8, raw_filename); |
| 407 | std.mem.replaceScalar(u8, copied, '\\', '/'); |
| 408 | break :name copied; |
| 409 | }; |
| 402 | 410 | |
| 403 | 411 | if (expected.is_note != is_note or |
| 404 | 412 | !std.mem.eql(u8, expected.filename, filename) or |