diff --git a/test/incremental/change_zon_file b/test/incremental/change_zon_file new file mode 100644 index 0000000000..da55c8ad83 --- /dev/null +++ b/test/incremental/change_zon_file @@ -0,0 +1,46 @@ +#target=x86_64-linux-selfhosted +#target=x86_64-linux-cbe +#target=x86_64-windows-cbe +//#target=wasm32-wasi-selfhosted +#update=initial version +#file=main.zig +const std = @import("std"); +const message: []const u8 = @import("message.zon"); +pub fn main() !void { + try std.io.getStdOut().writeAll(message); +} +#file=message.zon +"Hello, World!\n" +#expect_stdout="Hello, World!\n" + +#update=change ZON file contents +#file=message.zon +"Hello again, World!\n" +#expect_stdout="Hello again, World!\n" + +#update=delete file +#rm_file=message.zon +#expect_error=message.zon:1:1: error: unable to load './message.zon': FileNotFound + +#update=remove reference to ZON file +#file=main.zig +const std = @import("std"); +const message: []const u8 = @import("message.zon"); +pub fn main() !void { + try std.io.getStdOut().writeAll("a hardcoded string\n"); +} +#expect_error=message.zon:1:1: error: unable to load './message.zon': FileNotFound + +#update=recreate ZON file +#file=message.zon +"We're back, World!\n" +#expect_stdout="a hardcoded string\n" + +#update=re-introduce reference to ZON file +#file=main.zig +const std = @import("std"); +const message: []const u8 = @import("message.zon"); +pub fn main() !void { + try std.io.getStdOut().writeAll(message); +} +#expect_stdout="We're back, World!\n"