authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-19 20:40:24-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-23 22:15:11-08:00
logdebf3075942a0a8aa4078ffefc2f1201dd92d72b
tree51d16aa7b96f1d3989e85ecbfb737e2650bb0c0f
parent77d2ad8c929680ed35fcfe6646f940518a07e7e4

update all incremental tests to new std API

they're still not passing on windows for some reason though

26 files changed, 155 insertions(+), 80 deletions(-)

test/incremental/add_decl+13-7
......@@ -7,57 +7,63 @@
77#file=main.zig
88const std = @import("std");
99pub fn main() !void {
10 try std.Io.File.stdout().writeAll(foo);
10 try std.Io.File.stdout().writeStreamingAll(io, foo);
1111}
1212const foo = "good morning\n";
13const io = std.Io.Threaded.global_single_threaded.ioBasic();
1314#expect_stdout="good morning\n"
1415
1516#update=add new declaration
1617#file=main.zig
1718const std = @import("std");
1819pub fn main() !void {
19 try std.Io.File.stdout().writeAll(foo);
20 try std.Io.File.stdout().writeStreamingAll(io, foo);
2021}
2122const foo = "good morning\n";
2223const bar = "good evening\n";
24const io = std.Io.Threaded.global_single_threaded.ioBasic();
2325#expect_stdout="good morning\n"
2426
2527#update=reference new declaration
2628#file=main.zig
2729const std = @import("std");
2830pub fn main() !void {
29 try std.Io.File.stdout().writeAll(bar);
31 try std.Io.File.stdout().writeStreamingAll(io, bar);
3032}
3133const foo = "good morning\n";
3234const bar = "good evening\n";
35const io = std.Io.Threaded.global_single_threaded.ioBasic();
3336#expect_stdout="good evening\n"
3437
3538#update=reference missing declaration
3639#file=main.zig
3740const std = @import("std");
3841pub fn main() !void {
39 try std.Io.File.stdout().writeAll(qux);
42 try std.Io.File.stdout().writeStreamingAll(io, qux);
4043}
4144const foo = "good morning\n";
4245const bar = "good evening\n";
43#expect_error=main.zig:3:39: error: use of undeclared identifier 'qux'
46const io = std.Io.Threaded.global_single_threaded.ioBasic();
47#expect_error=main.zig:3:52: error: use of undeclared identifier 'qux'
4448
4549#update=add missing declaration
4650#file=main.zig
4751const std = @import("std");
4852pub fn main() !void {
49 try std.Io.File.stdout().writeAll(qux);
53 try std.Io.File.stdout().writeStreamingAll(io, qux);
5054}
5155const foo = "good morning\n";
5256const bar = "good evening\n";
5357const qux = "good night\n";
58const io = std.Io.Threaded.global_single_threaded.ioBasic();
5459#expect_stdout="good night\n"
5560
5661#update=remove unused declarations
5762#file=main.zig
5863const std = @import("std");
5964pub fn main() !void {
60 try std.Io.File.stdout().writeAll(qux);
65 try std.Io.File.stdout().writeStreamingAll(io, qux);
6166}
6267const qux = "good night\n";
68const io = std.Io.Threaded.global_single_threaded.ioBasic();
6369#expect_stdout="good night\n"
test/incremental/add_decl_namespaced+13-7
......@@ -7,58 +7,64 @@
77#file=main.zig
88const std = @import("std");
99pub fn main() !void {
10 try std.Io.File.stdout().writeAll(@This().foo);
10 try std.Io.File.stdout().writeStreamingAll(io, @This().foo);
1111}
1212const foo = "good morning\n";
13const io = std.Io.Threaded.global_single_threaded.ioBasic();
1314#expect_stdout="good morning\n"
1415
1516#update=add new declaration
1617#file=main.zig
1718const std = @import("std");
1819pub fn main() !void {
19 try std.Io.File.stdout().writeAll(@This().foo);
20 try std.Io.File.stdout().writeStreamingAll(io, @This().foo);
2021}
2122const foo = "good morning\n";
2223const bar = "good evening\n";
24const io = std.Io.Threaded.global_single_threaded.ioBasic();
2325#expect_stdout="good morning\n"
2426
2527#update=reference new declaration
2628#file=main.zig
2729const std = @import("std");
2830pub fn main() !void {
29 try std.Io.File.stdout().writeAll(@This().bar);
31 try std.Io.File.stdout().writeStreamingAll(io, @This().bar);
3032}
3133const foo = "good morning\n";
3234const bar = "good evening\n";
35const io = std.Io.Threaded.global_single_threaded.ioBasic();
3336#expect_stdout="good evening\n"
3437
3538#update=reference missing declaration
3639#file=main.zig
3740const std = @import("std");
3841pub fn main() !void {
39 try std.Io.File.stdout().writeAll(@This().qux);
42 try std.Io.File.stdout().writeStreamingAll(io, @This().qux);
4043}
4144const foo = "good morning\n";
4245const bar = "good evening\n";
43#expect_error=main.zig:3:46: error: root source file struct 'main' has no member named 'qux'
46const io = std.Io.Threaded.global_single_threaded.ioBasic();
47#expect_error=main.zig:3:59: error: root source file struct 'main' has no member named 'qux'
4448#expect_error=main.zig:1:1: note: struct declared here
4549
4650#update=add missing declaration
4751#file=main.zig
4852const std = @import("std");
4953pub fn main() !void {
50 try std.Io.File.stdout().writeAll(@This().qux);
54 try std.Io.File.stdout().writeStreamingAll(io, @This().qux);
5155}
5256const foo = "good morning\n";
5357const bar = "good evening\n";
5458const qux = "good night\n";
59const io = std.Io.Threaded.global_single_threaded.ioBasic();
5560#expect_stdout="good night\n"
5661
5762#update=remove unused declarations
5863#file=main.zig
5964const std = @import("std");
6065pub fn main() !void {
61 try std.Io.File.stdout().writeAll(@This().qux);
66 try std.Io.File.stdout().writeStreamingAll(io, @This().qux);
6267}
6368const qux = "good night\n";
69const io = std.Io.Threaded.global_single_threaded.ioBasic();
6470#expect_stdout="good night\n"
test/incremental/bad_import+4-2
......@@ -8,9 +8,10 @@
88#file=main.zig
99pub fn main() !void {
1010 _ = @import("foo.zig");
11 try std.Io.File.stdout().writeAll("success\n");
11 try std.Io.File.stdout().writeStreamingAll(io, "success\n");
1212}
1313const std = @import("std");
14const io = std.Io.Threaded.global_single_threaded.ioBasic();
1415#file=foo.zig
1516comptime {
1617 _ = @import("bad.zig");
......@@ -30,7 +31,8 @@ comptime {
3031#file=main.zig
3132pub fn main() !void {
3233 //_ = @import("foo.zig");
33 try std.Io.File.stdout().writeAll("success\n");
34 try std.Io.File.stdout().writeStreamingAll(io, "success\n");
3435}
3536const std = @import("std");
37const io = std.Io.Threaded.global_single_threaded.ioBasic();
3638#expect_stdout="success\n"
test/incremental/change_embed_file+6-3
......@@ -8,8 +8,9 @@
88const std = @import("std");
99const string = @embedFile("string.txt");
1010pub fn main() !void {
11 try std.Io.File.stdout().writeAll(string);
11 try std.Io.File.stdout().writeStreamingAll(io, string);
1212}
13const io = std.Io.Threaded.global_single_threaded.ioBasic();
1314#file=string.txt
1415Hello, World!
1516#expect_stdout="Hello, World!\n"
......@@ -28,8 +29,9 @@ Hello again, World!
2829const std = @import("std");
2930const string = @embedFile("string.txt");
3031pub fn main() !void {
31 try std.Io.File.stdout().writeAll("a hardcoded string\n");
32 try std.Io.File.stdout().writeStreamingAll(io, "a hardcoded string\n");
3233}
34const io = std.Io.Threaded.global_single_threaded.ioBasic();
3335#expect_stdout="a hardcoded string\n"
3436
3537#update=re-introduce reference to file
......@@ -37,8 +39,9 @@ pub fn main() !void {
3739const std = @import("std");
3840const string = @embedFile("string.txt");
3941pub fn main() !void {
40 try std.Io.File.stdout().writeAll(string);
42 try std.Io.File.stdout().writeStreamingAll(io, string);
4143}
44const io = std.Io.Threaded.global_single_threaded.ioBasic();
4245#expect_error=main.zig:2:27: error: unable to open 'string.txt': FileNotFound
4346
4447#update=recreate file
test/incremental/change_enum_tag_type+6-3
......@@ -15,10 +15,11 @@ const Foo = enum(Tag) {
1515pub fn main() !void {
1616 var val: Foo = undefined;
1717 val = .a;
18 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
18 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
1919 try stdout_writer.interface.print("{s}\n", .{@tagName(val)});
2020}
2121const std = @import("std");
22const io = std.Io.Threaded.global_single_threaded.ioBasic();
2223#expect_stdout="a\n"
2324#update=too many enum fields
2425#file=main.zig
......@@ -33,7 +34,7 @@ const Foo = enum(Tag) {
3334pub fn main() !void {
3435 var val: Foo = undefined;
3536 val = .a;
36 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
37 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
3738 try stdout_writer.interface.print("{s}\n", .{@tagName(val)});
3839}
3940comptime {
......@@ -42,6 +43,7 @@ comptime {
4243 std.debug.assert(@TypeOf(@intFromEnum(Foo.e)) == Tag);
4344}
4445const std = @import("std");
46const io = std.Io.Threaded.global_single_threaded.ioBasic();
4547#expect_error=main.zig:7:5: error: enumeration value '4' too large for type 'u2'
4648#update=increase tag size
4749#file=main.zig
......@@ -56,8 +58,9 @@ const Foo = enum(Tag) {
5658pub fn main() !void {
5759 var val: Foo = undefined;
5860 val = .a;
59 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
61 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
6062 try stdout_writer.interface.print("{s}\n", .{@tagName(val)});
6163}
6264const std = @import("std");
65const io = std.Io.Threaded.global_single_threaded.ioBasic();
6366#expect_stdout="a\n"
test/incremental/change_exports+12-6
......@@ -17,10 +17,11 @@ pub fn main() !void {
1717 extern const bar: u32;
1818 };
1919 S.foo();
20 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
20 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
2121 try stdout_writer.interface.print("{}\n", .{S.bar});
2222}
2323const std = @import("std");
24const io = std.Io.Threaded.global_single_threaded.ioBasic();
2425#expect_stdout="123\n"
2526
2627#update=add conflict
......@@ -39,10 +40,11 @@ pub fn main() !void {
3940 extern const other: u32;
4041 };
4142 S.foo();
42 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
43 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
4344 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
4445}
4546const std = @import("std");
47const io = std.Io.Threaded.global_single_threaded.ioBasic();
4648#expect_error=main.zig:6:5: error: exported symbol collision: foo
4749#expect_error=main.zig:1:1: note: other symbol here
4850
......@@ -62,10 +64,11 @@ pub fn main() !void {
6264 extern const other: u32;
6365 };
6466 S.foo();
65 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
67 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
6668 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
6769}
6870const std = @import("std");
71const io = std.Io.Threaded.global_single_threaded.ioBasic();
6972#expect_stdout="123 456\n"
7073
7174#update=put exports in decl
......@@ -87,10 +90,11 @@ pub fn main() !void {
8790 extern const other: u32;
8891 };
8992 S.foo();
90 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
93 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
9194 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
9295}
9396const std = @import("std");
97const io = std.Io.Threaded.global_single_threaded.ioBasic();
9498#expect_stdout="123 456\n"
9599
96100#update=remove reference to exporting decl
......@@ -133,10 +137,11 @@ pub fn main() !void {
133137 extern const other: u32;
134138 };
135139 S.foo();
136 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
140 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
137141 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
138142}
139143const std = @import("std");
144const io = std.Io.Threaded.global_single_threaded.ioBasic();
140145#expect_stdout="123 456\n"
141146
142147#update=reintroduce reference to exporting decl, introducing conflict
......@@ -158,10 +163,11 @@ pub fn main() !void {
158163 extern const other: u32;
159164 };
160165 S.foo();
161 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
166 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
162167 try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other });
163168}
164169const std = @import("std");
170const io = std.Io.Threaded.global_single_threaded.ioBasic();
165171#expect_error=main.zig:5:5: error: exported symbol collision: bar
166172#expect_error=main.zig:2:1: note: other symbol here
167173#expect_error=main.zig:6:5: error: exported symbol collision: other
test/incremental/change_fn_type+6-3
......@@ -8,10 +8,11 @@ pub fn main() !void {
88 try foo(123);
99}
1010fn foo(x: u8) !void {
11 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
11 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
1212 return stdout_writer.interface.print("{d}\n", .{x});
1313}
1414const std = @import("std");
15const io = std.Io.Threaded.global_single_threaded.ioBasic();
1516#expect_stdout="123\n"
1617
1718#update=change function type
......@@ -20,10 +21,11 @@ pub fn main() !void {
2021 try foo(123);
2122}
2223fn foo(x: i64) !void {
23 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
24 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
2425 return stdout_writer.interface.print("{d}\n", .{x});
2526}
2627const std = @import("std");
28const io = std.Io.Threaded.global_single_threaded.ioBasic();
2729#expect_stdout="123\n"
2830
2931#update=change function argument
......@@ -32,8 +34,9 @@ pub fn main() !void {
3234 try foo(-42);
3335}
3436fn foo(x: i64) !void {
35 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
37 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
3638 return stdout_writer.interface.print("{d}\n", .{x});
3739}
3840const std = @import("std");
41const io = std.Io.Threaded.global_single_threaded.ioBasic();
3942#expect_stdout="-42\n"
test/incremental/change_generic_line_number+4-2
......@@ -4,10 +4,11 @@
44#update=initial version
55#file=main.zig
66const std = @import("std");
7const io = std.Io.Threaded.global_single_threaded.ioBasic();
78fn Printer(message: []const u8) type {
89 return struct {
910 fn print() !void {
10 try std.Io.File.stdout().writeAll(message);
11 try std.Io.File.stdout().writeStreamingAll(io, message);
1112 }
1213 };
1314}
......@@ -19,11 +20,12 @@ pub fn main() !void {
1920#update=change line number
2021#file=main.zig
2122const std = @import("std");
23const io = std.Io.Threaded.global_single_threaded.ioBasic();
2224
2325fn Printer(message: []const u8) type {
2426 return struct {
2527 fn print() !void {
26 try std.Io.File.stdout().writeAll(message);
28 try std.Io.File.stdout().writeStreamingAll(io, message);
2729 }
2830 };
2931}
test/incremental/change_line_number+4-2
......@@ -5,14 +5,16 @@
55#file=main.zig
66const std = @import("std");
77pub fn main() !void {
8 try std.Io.File.stdout().writeAll("foo\n");
8 try std.Io.File.stdout().writeStreamingAll(io, "foo\n");
99}
10const io = std.Io.Threaded.global_single_threaded.ioBasic();
1011#expect_stdout="foo\n"
1112#update=change line number
1213#file=main.zig
1314const std = @import("std");
1415
1516pub fn main() !void {
16 try std.Io.File.stdout().writeAll("foo\n");
17 try std.Io.File.stdout().writeStreamingAll(io, "foo\n");
1718}
19const io = std.Io.Threaded.global_single_threaded.ioBasic();
1820#expect_stdout="foo\n"
test/incremental/change_panic_handler+6-3
......@@ -12,11 +12,12 @@ pub fn main() !u8 {
1212}
1313pub const panic = std.debug.FullPanic(myPanic);
1414fn myPanic(msg: []const u8, _: ?usize) noreturn {
15 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
15 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
1616 stdout_writer.interface.print("panic message: {s}\n", .{msg}) catch {};
1717 std.process.exit(0);
1818}
1919const std = @import("std");
20const io = std.Io.Threaded.global_single_threaded.ioBasic();
2021#expect_stdout="panic message: integer overflow\n"
2122
2223#update=change the panic handler body
......@@ -29,11 +30,12 @@ pub fn main() !u8 {
2930}
3031pub const panic = std.debug.FullPanic(myPanic);
3132fn myPanic(msg: []const u8, _: ?usize) noreturn {
32 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
33 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
3334 stdout_writer.interface.print("new panic message: {s}\n", .{msg}) catch {};
3435 std.process.exit(0);
3536}
3637const std = @import("std");
38const io = std.Io.Threaded.global_single_threaded.ioBasic();
3739#expect_stdout="new panic message: integer overflow\n"
3840
3941#update=change the panic handler function value
......@@ -46,9 +48,10 @@ pub fn main() !u8 {
4648}
4749pub const panic = std.debug.FullPanic(myPanicNew);
4850fn myPanicNew(msg: []const u8, _: ?usize) noreturn {
49 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
51 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
5052 stdout_writer.interface.print("third panic message: {s}\n", .{msg}) catch {};
5153 std.process.exit(0);
5254}
5355const std = @import("std");
56const io = std.Io.Threaded.global_single_threaded.ioBasic();
5457#expect_stdout="third panic message: integer overflow\n"
test/incremental/change_panic_handler_explicit+6-3
......@@ -42,11 +42,12 @@ pub const panic = struct {
4242 pub const noreturnReturned = no_panic.noreturnReturned;
4343};
4444fn myPanic(msg: []const u8, _: ?usize) noreturn {
45 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
45 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
4646 stdout_writer.interface.print("panic message: {s}\n", .{msg}) catch {};
4747 std.process.exit(0);
4848}
4949const std = @import("std");
50const io = std.Io.Threaded.global_single_threaded.ioBasic();
5051#expect_stdout="panic message: integer overflow\n"
5152
5253#update=change the panic handler body
......@@ -89,11 +90,12 @@ pub const panic = struct {
8990 pub const noreturnReturned = no_panic.noreturnReturned;
9091};
9192fn myPanic(msg: []const u8, _: ?usize) noreturn {
92 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
93 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
9394 stdout_writer.interface.print("new panic message: {s}\n", .{msg}) catch {};
9495 std.process.exit(0);
9596}
9697const std = @import("std");
98const io = std.Io.Threaded.global_single_threaded.ioBasic();
9799#expect_stdout="new panic message: integer overflow\n"
98100
99101#update=change the panic handler function value
......@@ -136,9 +138,10 @@ pub const panic = struct {
136138 pub const noreturnReturned = no_panic.noreturnReturned;
137139};
138140fn myPanicNew(msg: []const u8, _: ?usize) noreturn {
139 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
141 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
140142 stdout_writer.interface.print("third panic message: {s}\n", .{msg}) catch {};
141143 std.process.exit(0);
142144}
143145const std = @import("std");
146const io = std.Io.Threaded.global_single_threaded.ioBasic();
144147#expect_stdout="third panic message: integer overflow\n"
test/incremental/change_shift_op+4-2
......@@ -9,10 +9,11 @@ pub fn main() !void {
99 try foo(0x1300);
1010}
1111fn foo(x: u16) !void {
12 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
12 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
1313 try stdout_writer.interface.print("0x{x}\n", .{x << 4});
1414}
1515const std = @import("std");
16const io = std.Io.Threaded.global_single_threaded.ioBasic();
1617#expect_stdout="0x3000\n"
1718#update=change to right shift
1819#file=main.zig
......@@ -20,8 +21,9 @@ pub fn main() !void {
2021 try foo(0x1300);
2122}
2223fn foo(x: u16) !void {
23 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
24 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
2425 try stdout_writer.interface.print("0x{x}\n", .{x >> 4});
2526}
2627const std = @import("std");
28const io = std.Io.Threaded.global_single_threaded.ioBasic();
2729#expect_stdout="0x130\n"
test/incremental/change_struct_same_fields+6-3
......@@ -11,13 +11,14 @@ pub fn main() !void {
1111 try foo(&val);
1212}
1313fn foo(val: *const S) !void {
14 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
14 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
1515 try stdout_writer.interface.print(
1616 "{d} {d}\n",
1717 .{ val.x, val.y },
1818 );
1919}
2020const std = @import("std");
21const io = std.Io.Threaded.global_single_threaded.ioBasic();
2122#expect_stdout="100 200\n"
2223
2324#update=change struct layout
......@@ -28,13 +29,14 @@ pub fn main() !void {
2829 try foo(&val);
2930}
3031fn foo(val: *const S) !void {
31 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
32 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
3233 try stdout_writer.interface.print(
3334 "{d} {d}\n",
3435 .{ val.x, val.y },
3536 );
3637}
3738const std = @import("std");
39const io = std.Io.Threaded.global_single_threaded.ioBasic();
3840#expect_stdout="100 200\n"
3941
4042#update=change values
......@@ -45,11 +47,12 @@ pub fn main() !void {
4547 try foo(&val);
4648}
4749fn foo(val: *const S) !void {
48 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
50 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
4951 try stdout_writer.interface.print(
5052 "{d} {d}\n",
5153 .{ val.x, val.y },
5254 );
5355}
5456const std = @import("std");
57const io = std.Io.Threaded.global_single_threaded.ioBasic();
5558#expect_stdout="1234 5678\n"
test/incremental/change_zon_file+6-3
......@@ -8,8 +8,9 @@
88const std = @import("std");
99const message: []const u8 = @import("message.zon");
1010pub fn main() !void {
11 try std.Io.File.stdout().writeAll(message);
11 try std.Io.File.stdout().writeStreamingAll(io, message);
1212}
13const io = std.Io.Threaded.global_single_threaded.ioBasic();
1314#file=message.zon
1415"Hello, World!\n"
1516#expect_stdout="Hello, World!\n"
......@@ -29,8 +30,9 @@ pub fn main() !void {
2930const std = @import("std");
3031const message: []const u8 = @import("message.zon");
3132pub fn main() !void {
32 try std.Io.File.stdout().writeAll("a hardcoded string\n");
33 try std.Io.File.stdout().writeStreamingAll(io, "a hardcoded string\n");
3334}
35const io = std.Io.Threaded.global_single_threaded.ioBasic();
3436#expect_error=message.zon:1:1: error: unable to load 'message.zon': FileNotFound
3537#expect_error=main.zig:2:37: note: file imported here
3638
......@@ -44,6 +46,7 @@ pub fn main() !void {
4446const std = @import("std");
4547const message: []const u8 = @import("message.zon");
4648pub fn main() !void {
47 try std.Io.File.stdout().writeAll(message);
49 try std.Io.File.stdout().writeStreamingAll(io, message);
4850}
51const io = std.Io.Threaded.global_single_threaded.ioBasic();
4952#expect_stdout="We're back, World!\n"
test/incremental/change_zon_file_no_result_type+2-1
......@@ -6,8 +6,9 @@
66#update=initial version
77#file=main.zig
88const std = @import("std");
9const io = std.Io.Threaded.global_single_threaded.ioBasic();
910pub fn main() !void {
10 try std.Io.File.stdout().writeAll(@import("foo.zon").message);
11 try std.Io.File.stdout().writeStreamingAll(io, @import("foo.zon").message);
1112}
1213#file=foo.zon
1314.{
test/incremental/compile_log+6-3
......@@ -8,17 +8,19 @@
88#file=main.zig
99const std = @import("std");
1010pub fn main() !void {
11 try std.Io.File.stdout().writeAll("Hello, World!\n");
11 try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
1212}
13const io = std.Io.Threaded.global_single_threaded.ioBasic();
1314#expect_stdout="Hello, World!\n"
1415
1516#update=add compile log
1617#file=main.zig
1718const std = @import("std");
1819pub fn main() !void {
19 try std.Io.File.stdout().writeAll("Hello, World!\n");
20 try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
2021 @compileLog("this is a log");
2122}
23const io = std.Io.Threaded.global_single_threaded.ioBasic();
2224#expect_error=main.zig:4:5: error: found compile log statement
2325#expect_compile_log=@as(*const [13:0]u8, "this is a log")
2426
......@@ -26,6 +28,7 @@ pub fn main() !void {
2628#file=main.zig
2729const std = @import("std");
2830pub fn main() !void {
29 try std.Io.File.stdout().writeAll("Hello, World!\n");
31 try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
3032}
33const io = std.Io.Threaded.global_single_threaded.ioBasic();
3134#expect_stdout="Hello, World!\n"
test/incremental/fix_astgen_failure+8-5
......@@ -10,28 +10,31 @@ pub fn main() !void {
1010}
1111#file=foo.zig
1212pub fn hello() !void {
13 try std.Io.File.stdout().writeAll("Hello, World!\n");
13 try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
1414}
1515#expect_error=foo.zig:2:9: error: use of undeclared identifier 'std'
1616#update=fix the error
1717#file=foo.zig
1818const std = @import("std");
1919pub fn hello() !void {
20 try std.Io.File.stdout().writeAll("Hello, World!\n");
20 try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
2121}
22const io = std.Io.Threaded.global_single_threaded.ioBasic();
2223#expect_stdout="Hello, World!\n"
2324#update=add new error
2425#file=foo.zig
2526const std = @import("std");
2627pub fn hello() !void {
27 try std.Io.File.stdout().writeAll(hello_str);
28 try std.Io.File.stdout().writeStreamingAll(io, hello_str);
2829}
29#expect_error=foo.zig:3:39: error: use of undeclared identifier 'hello_str'
30const io = std.Io.Threaded.global_single_threaded.ioBasic();
31#expect_error=foo.zig:3:52: error: use of undeclared identifier 'hello_str'
3032#update=fix the new error
3133#file=foo.zig
3234const std = @import("std");
3335const hello_str = "Hello, World! Again!\n";
3436pub fn hello() !void {
35 try std.Io.File.stdout().writeAll(hello_str);
37 try std.Io.File.stdout().writeStreamingAll(io, hello_str);
3638}
39const io = std.Io.Threaded.global_single_threaded.ioBasic();
3740#expect_stdout="Hello, World! Again!\n"
test/incremental/function_becomes_inline+6-3
......@@ -8,9 +8,10 @@ pub fn main() !void {
88 try foo();
99}
1010fn foo() !void {
11 try std.Io.File.stdout().writeAll("Hello, World!\n");
11 try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
1212}
1313const std = @import("std");
14const io = std.Io.Threaded.global_single_threaded.ioBasic();
1415#expect_stdout="Hello, World!\n"
1516
1617#update=make function inline
......@@ -19,9 +20,10 @@ pub fn main() !void {
1920 try foo();
2021}
2122inline fn foo() !void {
22 try std.Io.File.stdout().writeAll("Hello, World!\n");
23 try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
2324}
2425const std = @import("std");
26const io = std.Io.Threaded.global_single_threaded.ioBasic();
2527#expect_stdout="Hello, World!\n"
2628
2729#update=change string
......@@ -30,7 +32,8 @@ pub fn main() !void {
3032 try foo();
3133}
3234inline fn foo() !void {
33 try std.Io.File.stdout().writeAll("Hello, `inline` World!\n");
35 try std.Io.File.stdout().writeStreamingAll(io, "Hello, `inline` World!\n");
3436}
3537const std = @import("std");
38const io = std.Io.Threaded.global_single_threaded.ioBasic();
3639#expect_stdout="Hello, `inline` World!\n"
test/incremental/hello+4-2
......@@ -6,14 +6,16 @@
66#update=initial version
77#file=main.zig
88const std = @import("std");
9const io = std.Io.Threaded.global_single_threaded.ioBasic();
910pub fn main() !void {
10 try std.Io.File.stdout().writeAll("good morning\n");
11 try std.Io.File.stdout().writeStreamingAll(io, "good morning\n");
1112}
1213#expect_stdout="good morning\n"
1314#update=change the string
1415#file=main.zig
1516const std = @import("std");
17const io = std.Io.Threaded.global_single_threaded.ioBasic();
1618pub fn main() !void {
17 try std.Io.File.stdout().writeAll("おはようございます\n");
19 try std.Io.File.stdout().writeStreamingAll(io, "おはようございます\n");
1820}
1921#expect_stdout="おはようございます\n"
test/incremental/make_decl_pub+4-2
......@@ -12,8 +12,9 @@ pub fn main() !void {
1212#file=foo.zig
1313const std = @import("std");
1414fn hello() !void {
15 try std.Io.File.stdout().writeAll("Hello, World!\n");
15 try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
1616}
17const io = std.Io.Threaded.global_single_threaded.ioBasic();
1718#expect_error=main.zig:3:12: error: 'hello' is not marked 'pub'
1819#expect_error=foo.zig:2:1: note: declared here
1920
......@@ -21,6 +22,7 @@ fn hello() !void {
2122#file=foo.zig
2223const std = @import("std");
2324pub fn hello() !void {
24 try std.Io.File.stdout().writeAll("Hello, World!\n");
25 try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n");
2526}
27const io = std.Io.Threaded.global_single_threaded.ioBasic();
2628#expect_stdout="Hello, World!\n"
test/incremental/modify_inline_fn+4-2
......@@ -8,20 +8,22 @@
88const std = @import("std");
99pub fn main() !void {
1010 const str = getStr();
11 try std.Io.File.stdout().writeAll(str);
11 try std.Io.File.stdout().writeStreamingAll(io, str);
1212}
1313inline fn getStr() []const u8 {
1414 return "foo\n";
1515}
16const io = std.Io.Threaded.global_single_threaded.ioBasic();
1617#expect_stdout="foo\n"
1718#update=change the string
1819#file=main.zig
1920const std = @import("std");
2021pub fn main() !void {
2122 const str = getStr();
22 try std.Io.File.stdout().writeAll(str);
23 try std.Io.File.stdout().writeStreamingAll(io, str);
2324}
2425inline fn getStr() []const u8 {
2526 return "bar\n";
2627}
28const io = std.Io.Threaded.global_single_threaded.ioBasic();
2729#expect_stdout="bar\n"
test/incremental/move_src+4-2
......@@ -7,7 +7,7 @@
77#file=main.zig
88const std = @import("std");
99pub fn main() !void {
10 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
10 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
1111 try stdout_writer.interface.print("{d} {d}\n", .{ foo(), bar() });
1212}
1313fn foo() u32 {
......@@ -16,13 +16,14 @@ fn foo() u32 {
1616fn bar() u32 {
1717 return 123;
1818}
19const io = std.Io.Threaded.global_single_threaded.ioBasic();
1920#expect_stdout="7 123\n"
2021
2122#update=add newline
2223#file=main.zig
2324const std = @import("std");
2425pub fn main() !void {
25 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
26 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
2627 try stdout_writer.interface.print("{d} {d}\n", .{ foo(), bar() });
2728}
2829
......@@ -32,4 +33,5 @@ fn foo() u32 {
3233fn bar() u32 {
3334 return 123;
3435}
36const io = std.Io.Threaded.global_single_threaded.ioBasic();
3537#expect_stdout="8 123\n"
test/incremental/no_change_preserves_tag_names+4-2
......@@ -7,15 +7,17 @@
77#file=main.zig
88const std = @import("std");
99var some_enum: enum { first, second } = .first;
10const io = std.Io.Threaded.global_single_threaded.ioBasic();
1011pub fn main() !void {
11 try std.Io.File.stdout().writeStreamingAll(std.Io.Threaded.global_single_threaded.ioBasic(), @tagName(some_enum));
12 try std.Io.File.stdout().writeStreamingAll(io, @tagName(some_enum));
1213}
1314#expect_stdout="first"
1415#update=no change
1516#file=main.zig
1617const std = @import("std");
1718var some_enum: enum { first, second } = .first;
19const io = std.Io.Threaded.global_single_threaded.ioBasic();
1820pub fn main() !void {
19 try std.Io.File.stdout().writeStreamingAll(std.Io.Threaded.global_single_threaded.ioBasic(), @tagName(some_enum));
21 try std.Io.File.stdout().writeStreamingAll(io, @tagName(some_enum));
2022}
2123#expect_stdout="first"
test/incremental/recursive_function_becomes_non_recursive+5-3
......@@ -11,9 +11,10 @@ pub fn main() !void {
1111fn foo(recurse: bool) !void {
1212 const stdout = std.Io.File.stdout();
1313 if (recurse) return foo(true);
14 try stdout.writeAll("non-recursive path\n");
14 try stdout.writeStreamingAll(io, "non-recursive path\n");
1515}
1616const std = @import("std");
17const io = std.Io.Threaded.global_single_threaded.ioBasic();
1718#expect_stdout="non-recursive path\n"
1819
1920#update=eliminate recursion and change argument
......@@ -23,8 +24,9 @@ pub fn main() !void {
2324}
2425fn foo(recurse: bool) !void {
2526 const stdout = std.Io.File.stdout();
26 if (recurse) return stdout.writeAll("x==1\n");
27 try stdout.writeAll("non-recursive path\n");
27 if (recurse) return stdout.writeStreamingAll(io, "x==1\n");
28 try stdout.writeStreamingAll(io, "non-recursive path\n");
2829}
2930const std = @import("std");
31const io = std.Io.Threaded.global_single_threaded.ioBasic();
3032#expect_stdout="x==1\n"
test/incremental/remove_enum_field+4-2
......@@ -10,10 +10,11 @@ const MyEnum = enum(u8) {
1010 bar = 2,
1111};
1212pub fn main() !void {
13 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
13 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
1414 try stdout_writer.interface.print("{}\n", .{@intFromEnum(MyEnum.foo)});
1515}
1616const std = @import("std");
17const io = std.Io.Threaded.global_single_threaded.ioBasic();
1718#expect_stdout="1\n"
1819#update=remove enum field
1920#file=main.zig
......@@ -22,9 +23,10 @@ const MyEnum = enum(u8) {
2223 bar = 2,
2324};
2425pub fn main() !void {
25 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
26 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
2627 try stdout_writer.interface.print("{}\n", .{@intFromEnum(MyEnum.foo)});
2728}
2829const std = @import("std");
30const io = std.Io.Threaded.global_single_threaded.ioBasic();
2931#expect_error=main.zig:7:69: error: enum 'main.MyEnum' has no member named 'foo'
3032#expect_error=main.zig:1:16: note: enum declared here
test/incremental/unreferenced_error+8-4
......@@ -7,36 +7,40 @@
77#file=main.zig
88const std = @import("std");
99pub fn main() !void {
10 try std.Io.File.stdout().writeAll(a);
10 try std.Io.File.stdout().writeStreamingAll(io, a);
1111}
1212const a = "Hello, World!\n";
13const io = std.Io.Threaded.global_single_threaded.ioBasic();
1314#expect_stdout="Hello, World!\n"
1415
1516#update=introduce compile error
1617#file=main.zig
1718const std = @import("std");
1819pub fn main() !void {
19 try std.Io.File.stdout().writeAll(a);
20 try std.Io.File.stdout().writeStreamingAll(io, a);
2021}
2122const a = @compileError("bad a");
23const io = std.Io.Threaded.global_single_threaded.ioBasic();
2224#expect_error=main.zig:5:11: error: bad a
2325
2426#update=remove error reference
2527#file=main.zig
2628const std = @import("std");
2729pub fn main() !void {
28 try std.Io.File.stdout().writeAll(b);
30 try std.Io.File.stdout().writeStreamingAll(io, b);
2931}
3032const a = @compileError("bad a");
3133const b = "Hi there!\n";
34const io = std.Io.Threaded.global_single_threaded.ioBasic();
3235#expect_stdout="Hi there!\n"
3336
3437#update=introduce and remove reference to error
3538#file=main.zig
3639const std = @import("std");
3740pub fn main() !void {
38 try std.Io.File.stdout().writeAll(a);
41 try std.Io.File.stdout().writeStreamingAll(io, a);
3942}
4043const a = "Back to a\n";
4144const b = @compileError("bad b");
45const io = std.Io.Threaded.global_single_threaded.ioBasic();
4246#expect_stdout="Back to a\n"