mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
incremental: add ZON test
This commit is contained in:
parent
fb481d0bf8
commit
d60910c9d0
46
test/incremental/change_zon_file
Normal file
46
test/incremental/change_zon_file
Normal 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"
|
||||||
Loading…
x
Reference in New Issue
Block a user