| 1 | #update=initial version |
| 2 | #file=main.zig |
| 3 | const std = @import("std"); |
| 4 | const message: []const u8 = @import("message.zon"); |
| 5 | pub fn main() !void { |
| 6 | try std.Io.File.stdout().writeStreamingAll(io, message); |
| 7 | } |
| 8 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 9 | #file=message.zon |
| 10 | "Hello, World!\n" |
| 11 | #expect_stdout="Hello, World!\n" |
| 12 | |
| 13 | #update=change ZON file contents |
| 14 | #file=message.zon |
| 15 | "Hello again, World!\n" |
| 16 | #expect_stdout="Hello again, World!\n" |
| 17 | |
| 18 | #update=delete file |
| 19 | #rm_file=message.zon |
| 20 | #expect_error=message.zon:1:1: error: unable to load 'message.zon': FileNotFound |
| 21 | #expect_error=main.zig:2:37: note: file imported here |
| 22 | |
| 23 | #update=remove reference to ZON file |
| 24 | #file=main.zig |
| 25 | const std = @import("std"); |
| 26 | const message: []const u8 = @import("message.zon"); |
| 27 | pub fn main() !void { |
| 28 | try std.Io.File.stdout().writeStreamingAll(io, "a hardcoded string\n"); |
| 29 | } |
| 30 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 31 | #expect_error=message.zon:1:1: error: unable to load 'message.zon': FileNotFound |
| 32 | #expect_error=main.zig:2:37: note: file imported here |
| 33 | |
| 34 | #update=recreate ZON file |
| 35 | #file=message.zon |
| 36 | "We're back, World!\n" |
| 37 | #expect_stdout="a hardcoded string\n" |
| 38 | |
| 39 | #update=re-introduce reference to ZON file |
| 40 | #file=main.zig |
| 41 | const std = @import("std"); |
| 42 | const message: []const u8 = @import("message.zon"); |
| 43 | pub fn main() !void { |
| 44 | try std.Io.File.stdout().writeStreamingAll(io, message); |
| 45 | } |
| 46 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 47 | #expect_stdout="We're back, World!\n" |