blob: c9eb2be929c0ce3231405b1d5a701ca560f8e882 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#target=x86_64-linux-selfhosted
#target=wasm32-wasi-selfhosted
#update=initial version
#file=main.zig
const std = @import("std");
fn Printer(message: []const u8) type {
return struct {
fn print() !void {
try std.fs.File.stdout().writeAll(message);
}
};
}
pub fn main() !void {
try Printer("foo\n").print();
try Printer("bar\n").print();
}
#expect_stdout="foo\nbar\n"
#update=change line number
#file=main.zig
const std = @import("std");
fn Printer(message: []const u8) type {
return struct {
fn print() !void {
try std.fs.File.stdout().writeAll(message);
}
};
}
pub fn main() !void {
try Printer("foo\n").print();
try Printer("bar\n").print();
}
#expect_stdout="foo\nbar\n"
|