| author | |
| committer | |
| log | e4c1598ac8dd984a480fad41e61cc60c41448cac |
| tree | 5507dd1348e172d0a8b05622df0c92b052b5e1b1 |
| parent | fbe1bbf662e339dd5f3bc01c83d236d867726854 |
2 files changed, 56 insertions(+), 3 deletions(-)
test/incremental2/bad_import created+48| ... | @@ -0,0 +1,48 @@ | ||
| 1 | #exe { | ||
| 2 | -Mroot=main.zig | ||
| 3 | #} | ||
| 4 | |||
| 5 | #write main.zig { | ||
| 6 | pub fn main() !void { | ||
| 7 | _ = @import("foo.zig"); | ||
| 8 | try std.Io.File.stdout().writeStreamingAll(io, "success\n"); | ||
| 9 | } | ||
| 10 | const std = @import("std"); | ||
| 11 | const io = std.Io.Threaded.global_single_threaded.io(); | ||
| 12 | #} | ||
| 13 | #write foo.zig { | ||
| 14 | comptime { | ||
| 15 | _ = @import("bad.zig"); | ||
| 16 | } | ||
| 17 | #} | ||
| 18 | #update | ||
| 19 | #check errors { | ||
| 20 | bad.zig:1:1: error: unable to load "bad.zig": FileNotFound | ||
| 21 | foo.zig:2:17: note: file imported here | ||
| 22 | #} | ||
| 23 | |||
| 24 | #write foo.zig { | ||
| 25 | comptime { | ||
| 26 | _ = @import("this_is/not_real.zig"); | ||
| 27 | } | ||
| 28 | #} | ||
| 29 | #update { | ||
| 30 | change bad import#} | ||
| 31 | #check errors { | ||
| 32 | this_is/not_real.zig:1:1: error: unable to load "not_real.zig": FileNotFound | ||
| 33 | foo.zig:2:17: note: file imported here | ||
| 34 | #} | ||
| 35 | |||
| 36 | #write main.zig { | ||
| 37 | pub fn main() !void { | ||
| 38 | //_ = @import("foo.zig"); | ||
| 39 | try std.Io.File.stdout().writeStreamingAll(io, "success\n"); | ||
| 40 | } | ||
| 41 | const std = @import("std"); | ||
| 42 | const io = std.Io.Threaded.global_single_threaded.io(); | ||
| 43 | #} | ||
| 44 | #update { | ||
| 45 | remove import of 'foo.zig'#} | ||
| 46 | #check stdout { | ||
| 47 | success | ||
| 48 | #} | ||
test/src/runner.zig+8-3| ... | @@ -749,9 +749,14 @@ fn runTest( | ... | @@ -749,9 +749,14 @@ fn runTest( |
| 749 | stderr.tossBuffered(); | 749 | stderr.tossBuffered(); |
| 750 | } | 750 | } |
| 751 | switch (check) { | 751 | switch (check) { |
| 752 | .errors => if (error_bundle.errorMessageCount() != 0) { | 752 | .errors => { |
| 753 | @panic("TODO"); | 753 | var error_aw: std.Io.Writer.Allocating = .init(gpa); |
| 754 | } else fatal("expected compile errors", .{}), | 754 | defer error_aw.deinit(); |
| 755 | try error_bundle.renderToWriter(.{ | ||
| 756 | .include_source_line = false, | ||
| 757 | }, &error_aw.writer); | ||
| 758 | try std.testing.expectEqualStrings(expected, error_aw.written()); | ||
| 759 | }, | ||
| 755 | .stdout, .exit, .lldb => if (error_bundle.errorMessageCount() != 0) { | 760 | .stdout, .exit, .lldb => if (error_bundle.errorMessageCount() != 0) { |
| 756 | try error_bundle.renderToStderr(io, .{}, .auto); | 761 | try error_bundle.renderToStderr(io, .{}, .auto); |
| 757 | fatal("unexpected compile errors", .{}); | 762 | fatal("unexpected compile errors", .{}); |