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