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