| 1 | #exe { |
| 2 | -Mroot=main.zig |
| 3 | #} |
| 4 | |
| 5 | #write main.zig { |
| 6 | const std = @import("std"); |
| 7 | pub fn main() !void { |
| 8 | try std.Io.File.stdout().writeStreamingAll(io, a); |
| 9 | } |
| 10 | const a = "Hello, World!\n"; |
| 11 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 12 | #} |
| 13 | #update |
| 14 | #check stdout { |
| 15 | Hello, World! |
| 16 | #} |
| 17 | |
| 18 | #write main.zig { |
| 19 | const std = @import("std"); |
| 20 | pub fn main() !void { |
| 21 | try std.Io.File.stdout().writeStreamingAll(io, a); |
| 22 | } |
| 23 | const a = @compileError("bad a"); |
| 24 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 25 | #} |
| 26 | #update "introduce compile error" |
| 27 | #check errors { |
| 28 | main.zig:5:11: error: bad a |
| 29 | #} |
| 30 | |
| 31 | #write main.zig { |
| 32 | const std = @import("std"); |
| 33 | pub fn main() !void { |
| 34 | try std.Io.File.stdout().writeStreamingAll(io, b); |
| 35 | } |
| 36 | const a = @compileError("bad a"); |
| 37 | const b = "Hi there!\n"; |
| 38 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 39 | #} |
| 40 | #update "remove error reference" |
| 41 | #check stdout { |
| 42 | Hi there! |
| 43 | #} |
| 44 | |
| 45 | #write main.zig { |
| 46 | const std = @import("std"); |
| 47 | pub fn main() !void { |
| 48 | try std.Io.File.stdout().writeStreamingAll(io, a); |
| 49 | } |
| 50 | const a = "Back to a\n"; |
| 51 | const b = @compileError("bad b"); |
| 52 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 53 | #} |
| 54 | #update "introduce and remove reference to error" |
| 55 | #check stdout { |
| 56 | Back to a |
| 57 | #} |