1#exe {
2-Mroot=main.zig
3#}
4
5#write main.zig {
6const std = @import("std");
7const message: []const u8 = @import("message.zon");
8pub fn main() !void {
9 try std.Io.File.stdout().writeStreamingAll(io, message);
10}
11const io = std.Io.Threaded.global_single_threaded.io();
12#}
13#write message.zon {
14"Hello, World!\n"
15#}
16#update
17#check stdout {
18Hello, World!
19#}
20
21#write message.zon {
22"Hello again, World!\n"
23#}
24#update "change ZON file contents"
25#check stdout {
26Hello again, World!
27#}
28
29#delete message.zon
30#update "delete file"
31#check errors {
32message.zon:1:1: error: unable to load "message.zon": FileNotFound
33main.zig:2:37: note: file imported here
34#}
35
36#write main.zig {
37const std = @import("std");
38const message: []const u8 = @import("message.zon");
39pub fn main() !void {
40 try std.Io.File.stdout().writeStreamingAll(io, "a hardcoded string\n");
41}
42const io = std.Io.Threaded.global_single_threaded.io();
43#}
44#update "remove reference to ZON file"
45#check errors {
46message.zon:1:1: error: unable to load "message.zon": FileNotFound
47main.zig:2:37: note: file imported here
48#}
49
50#write message.zon {
51"We're back, World!\n"
52#}
53#update "recreate ZON file"
54#check stdout {
55a hardcoded string
56#}
57
58#write main.zig {
59const std = @import("std");
60const message: []const u8 = @import("message.zon");
61pub fn main() !void {
62 try std.Io.File.stdout().writeStreamingAll(io, message);
63}
64const io = std.Io.Threaded.global_single_threaded.io();
65#}
66#update "re-introduce reference to ZON file"
67#check stdout {
68We're back, World!
69#}