| 1 | #exe { |
| 2 | -Mroot=main.zig |
| 3 | #} |
| 4 | |
| 5 | #write main.zig { |
| 6 | const foo = @import("foo.zig"); |
| 7 | pub fn main() !void { |
| 8 | try foo.hello(); |
| 9 | } |
| 10 | #} |
| 11 | #write foo.zig { |
| 12 | const std = @import("std"); |
| 13 | fn hello() !void { |
| 14 | try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n"); |
| 15 | } |
| 16 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 17 | #} |
| 18 | #update |
| 19 | #check errors { |
| 20 | main.zig:3:12: error: 'hello' is not marked 'pub' |
| 21 | foo.zig:2:1: note: declared here |
| 22 | #} |
| 23 | |
| 24 | #write foo.zig { |
| 25 | const std = @import("std"); |
| 26 | pub fn hello() !void { |
| 27 | try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n"); |
| 28 | } |
| 29 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 30 | #} |
| 31 | #update "make hello pub" |
| 32 | #check stdout { |
| 33 | Hello, World! |
| 34 | #} |