| 1 | #exe { |
| 2 | -Mroot=main.zig |
| 3 | #} |
| 4 | |
| 5 | #write main.zig { |
| 6 | pub fn main() !void { |
| 7 | try @import("foo.zig").hello(); |
| 8 | } |
| 9 | #} |
| 10 | #write foo.zig { |
| 11 | pub fn hello() !void { |
| 12 | try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n"); |
| 13 | } |
| 14 | #} |
| 15 | #update "error" |
| 16 | #check errors { |
| 17 | foo.zig:2:9: error: use of undeclared identifier 'std' |
| 18 | #} |
| 19 | |
| 20 | #write foo.zig { |
| 21 | const std = @import("std"); |
| 22 | pub fn hello() !void { |
| 23 | try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n"); |
| 24 | } |
| 25 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 26 | #} |
| 27 | #update "fix the error" |
| 28 | #check stdout { |
| 29 | Hello, World! |
| 30 | #} |
| 31 | |
| 32 | #write foo.zig { |
| 33 | const std = @import("std"); |
| 34 | pub fn hello() !void { |
| 35 | try std.Io.File.stdout().writeStreamingAll(io, hello_str); |
| 36 | } |
| 37 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 38 | #} |
| 39 | #update "add new error" |
| 40 | #check errors { |
| 41 | foo.zig:3:52: error: use of undeclared identifier 'hello_str' |
| 42 | #} |
| 43 | |
| 44 | #write foo.zig { |
| 45 | const std = @import("std"); |
| 46 | const hello_str = "Hello, World! Again!\n"; |
| 47 | pub fn hello() !void { |
| 48 | try std.Io.File.stdout().writeStreamingAll(io, hello_str); |
| 49 | } |
| 50 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 51 | #} |
| 52 | #update "fix the new error" |
| 53 | #check stdout { |
| 54 | Hello, World! Again! |
| 55 | #} |