| 1 | #exe { |
| 2 | -Mroot=main.zig |
| 3 | #} |
| 4 | |
| 5 | #write main.zig { |
| 6 | pub fn main() !void { |
| 7 | try foo(); |
| 8 | } |
| 9 | fn foo() !void { |
| 10 | try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n"); |
| 11 | } |
| 12 | const std = @import("std"); |
| 13 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 14 | #} |
| 15 | #update "non-inline version" |
| 16 | #check stdout { |
| 17 | Hello, World! |
| 18 | #} |
| 19 | |
| 20 | #write main.zig { |
| 21 | pub fn main() !void { |
| 22 | try foo(); |
| 23 | } |
| 24 | inline fn foo() !void { |
| 25 | try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n"); |
| 26 | } |
| 27 | const std = @import("std"); |
| 28 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 29 | #} |
| 30 | #update "make function inline" |
| 31 | #check stdout { |
| 32 | Hello, World! |
| 33 | #} |
| 34 | |
| 35 | #write main.zig { |
| 36 | pub fn main() !void { |
| 37 | try foo(); |
| 38 | } |
| 39 | inline fn foo() !void { |
| 40 | try std.Io.File.stdout().writeStreamingAll(io, "Hello, `inline` World!\n"); |
| 41 | } |
| 42 | const std = @import("std"); |
| 43 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 44 | #} |
| 45 | #update "change string" |
| 46 | #check stdout { |
| 47 | Hello, `inline` World! |
| 48 | #} |