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