zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit d60910c9d0fa4d28a4f738e95357ddada84ae106 (tree)
parent fb481d0bf81df7b0ce9afde5cd615133d9895726
Author: mlugg <mlugg@mlugg.co.uk>
Date:   Tue,  4 Feb 2025 15:13:06 +0000

incremental: add ZON test

Diffstat:
Atest/incremental/change_zon_file | 46++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+), 0 deletions(-)

diff --git a/test/incremental/change_zon_file 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"