#exe {
-Mroot=main.zig
#}

#write main.zig {
const std = @import("std");
const string = @embedFile("string.txt");
pub fn main() !void {
    try std.Io.File.stdout().writeStreamingAll(io, string);
}
const io = std.Io.Threaded.global_single_threaded.io();
#}
#write string.txt {
Hello, World!
#}
#update
#check stdout {
Hello, World!
#}

#write string.txt {
Hello again, World!
#}
#update "change file contents"
#check stdout {
Hello again, World!
#}

#delete string.txt
#update "delete file"
#check errors {
main.zig:2:27: error: failed opening "string.txt": FileNotFound
#}

#write main.zig {
const std = @import("std");
const string = @embedFile("string.txt");
pub fn main() !void {
    try std.Io.File.stdout().writeStreamingAll(io, "a hardcoded string\n");
}
const io = std.Io.Threaded.global_single_threaded.io();
#}
#update "remove reference to file"
#check stdout {
a hardcoded string
#}

#write main.zig {
const std = @import("std");
const string = @embedFile("string.txt");
pub fn main() !void {
    try std.Io.File.stdout().writeStreamingAll(io, string);
}
const io = std.Io.Threaded.global_single_threaded.io();
#}
#update "re-introduce reference to file"
#check errors {
main.zig:2:27: error: failed opening "string.txt": FileNotFound
#}

#write string.txt {
We're back, World!
#}
#update "recreate file"
#check stdout {
We're back, World!
#}
