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