incremental: add ZON test

This commit is contained in:
mlugg 2025-02-04 15:13:06 +00:00
parent fb481d0bf8
commit d60910c9d0
No known key found for this signature in database
GPG Key ID: 3F5B7DCCBF4AF02E

View 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"