From debf3075942a0a8aa4078ffefc2f1201dd92d72b Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 19 Dec 2025 20:40:24 -0800 Subject: [PATCH] update all incremental tests to new std API they're still not passing on windows for some reason though --- test/incremental/add_decl | 20 ++++++++++++------- test/incremental/add_decl_namespaced | 20 ++++++++++++------- test/incremental/bad_import | 6 ++++-- test/incremental/change_embed_file | 9 ++++++--- test/incremental/change_enum_tag_type | 9 ++++++--- test/incremental/change_exports | 18 +++++++++++------ test/incremental/change_fn_type | 9 ++++++--- test/incremental/change_generic_line_number | 6 ++++-- test/incremental/change_line_number | 6 ++++-- test/incremental/change_panic_handler | 9 ++++++--- .../incremental/change_panic_handler_explicit | 9 ++++++--- test/incremental/change_shift_op | 6 ++++-- test/incremental/change_struct_same_fields | 9 ++++++--- test/incremental/change_zon_file | 9 ++++++--- .../change_zon_file_no_result_type | 3 ++- test/incremental/compile_log | 9 ++++++--- test/incremental/fix_astgen_failure | 13 +++++++----- test/incremental/function_becomes_inline | 9 ++++++--- test/incremental/hello | 6 ++++-- test/incremental/make_decl_pub | 6 ++++-- test/incremental/modify_inline_fn | 6 ++++-- test/incremental/move_src | 6 ++++-- .../incremental/no_change_preserves_tag_names | 6 ++++-- .../recursive_function_becomes_non_recursive | 8 +++++--- test/incremental/remove_enum_field | 6 ++++-- test/incremental/unreferenced_error | 12 +++++++---- 26 files changed, 155 insertions(+), 80 deletions(-) diff --git a/test/incremental/add_decl b/test/incremental/add_decl index 031085ca584c789842b5d74c56b86a065e4b9b89..99f6b2d34fb9c244caac9d0741f7511b6d279bbc 100644 --- a/test/incremental/add_decl +++ b/test/incremental/add_decl @@ -7,57 +7,63 @@ #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll(foo); + try std.Io.File.stdout().writeStreamingAll(io, foo); } const foo = "good morning\n"; +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="good morning\n" #update=add new declaration #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll(foo); + try std.Io.File.stdout().writeStreamingAll(io, foo); } const foo = "good morning\n"; const bar = "good evening\n"; +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="good morning\n" #update=reference new declaration #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll(bar); + try std.Io.File.stdout().writeStreamingAll(io, bar); } const foo = "good morning\n"; const bar = "good evening\n"; +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="good evening\n" #update=reference missing declaration #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll(qux); + try std.Io.File.stdout().writeStreamingAll(io, qux); } const foo = "good morning\n"; const bar = "good evening\n"; -#expect_error=main.zig:3:39: error: use of undeclared identifier 'qux' +const io = std.Io.Threaded.global_single_threaded.ioBasic(); +#expect_error=main.zig:3:52: error: use of undeclared identifier 'qux' #update=add missing declaration #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll(qux); + try std.Io.File.stdout().writeStreamingAll(io, qux); } const foo = "good morning\n"; const bar = "good evening\n"; const qux = "good night\n"; +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="good night\n" #update=remove unused declarations #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll(qux); + try std.Io.File.stdout().writeStreamingAll(io, qux); } const qux = "good night\n"; +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="good night\n" diff --git a/test/incremental/add_decl_namespaced b/test/incremental/add_decl_namespaced index cbeaf4865ecb7837d2b7584a5565a1930909e6b5..6fc22f10b9411cbeaa988618b0f2512d96bcf652 100644 --- a/test/incremental/add_decl_namespaced +++ b/test/incremental/add_decl_namespaced @@ -7,58 +7,64 @@ #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll(@This().foo); + try std.Io.File.stdout().writeStreamingAll(io, @This().foo); } const foo = "good morning\n"; +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="good morning\n" #update=add new declaration #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll(@This().foo); + try std.Io.File.stdout().writeStreamingAll(io, @This().foo); } const foo = "good morning\n"; const bar = "good evening\n"; +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="good morning\n" #update=reference new declaration #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll(@This().bar); + try std.Io.File.stdout().writeStreamingAll(io, @This().bar); } const foo = "good morning\n"; const bar = "good evening\n"; +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="good evening\n" #update=reference missing declaration #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll(@This().qux); + try std.Io.File.stdout().writeStreamingAll(io, @This().qux); } const foo = "good morning\n"; const bar = "good evening\n"; -#expect_error=main.zig:3:46: error: root source file struct 'main' has no member named 'qux' +const io = std.Io.Threaded.global_single_threaded.ioBasic(); +#expect_error=main.zig:3:59: error: root source file struct 'main' has no member named 'qux' #expect_error=main.zig:1:1: note: struct declared here #update=add missing declaration #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll(@This().qux); + try std.Io.File.stdout().writeStreamingAll(io, @This().qux); } const foo = "good morning\n"; const bar = "good evening\n"; const qux = "good night\n"; +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="good night\n" #update=remove unused declarations #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll(@This().qux); + try std.Io.File.stdout().writeStreamingAll(io, @This().qux); } const qux = "good night\n"; +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="good night\n" diff --git a/test/incremental/bad_import b/test/incremental/bad_import index ad66c17b5b5f6310b4c622e363d09ee4e35600ad..20bdb9ae82fcb1588688d3ae9290bf146b1ee142 100644 --- a/test/incremental/bad_import +++ b/test/incremental/bad_import @@ -8,9 +8,10 @@ #file=main.zig pub fn main() !void { _ = @import("foo.zig"); - try std.Io.File.stdout().writeAll("success\n"); + try std.Io.File.stdout().writeStreamingAll(io, "success\n"); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #file=foo.zig comptime { _ = @import("bad.zig"); @@ -30,7 +31,8 @@ comptime { #file=main.zig pub fn main() !void { //_ = @import("foo.zig"); - try std.Io.File.stdout().writeAll("success\n"); + try std.Io.File.stdout().writeStreamingAll(io, "success\n"); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="success\n" diff --git a/test/incremental/change_embed_file b/test/incremental/change_embed_file index 1eed90dc3250fa0079176d010565f02002b75f6b..84c9c334c72283d2ac5637064cd96a4fca37a0fe 100644 --- a/test/incremental/change_embed_file +++ b/test/incremental/change_embed_file @@ -8,8 +8,9 @@ const std = @import("std"); const string = @embedFile("string.txt"); pub fn main() !void { - try std.Io.File.stdout().writeAll(string); + try std.Io.File.stdout().writeStreamingAll(io, string); } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #file=string.txt Hello, World! #expect_stdout="Hello, World!\n" @@ -28,8 +29,9 @@ Hello again, World! const std = @import("std"); const string = @embedFile("string.txt"); pub fn main() !void { - try std.Io.File.stdout().writeAll("a hardcoded string\n"); + try std.Io.File.stdout().writeStreamingAll(io, "a hardcoded string\n"); } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="a hardcoded string\n" #update=re-introduce reference to file @@ -37,8 +39,9 @@ pub fn main() !void { const std = @import("std"); const string = @embedFile("string.txt"); pub fn main() !void { - try std.Io.File.stdout().writeAll(string); + try std.Io.File.stdout().writeStreamingAll(io, string); } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_error=main.zig:2:27: error: unable to open 'string.txt': FileNotFound #update=recreate file diff --git a/test/incremental/change_enum_tag_type b/test/incremental/change_enum_tag_type index 6e72b3e573fc2e6e18285b8b357144bed1b4a855..06b80ac04deb7f36956dff9d20c8704563602adc 100644 --- a/test/incremental/change_enum_tag_type +++ b/test/incremental/change_enum_tag_type @@ -15,10 +15,11 @@ const Foo = enum(Tag) { pub fn main() !void { var val: Foo = undefined; val = .a; - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print("{s}\n", .{@tagName(val)}); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="a\n" #update=too many enum fields #file=main.zig @@ -33,7 +34,7 @@ const Foo = enum(Tag) { pub fn main() !void { var val: Foo = undefined; val = .a; - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print("{s}\n", .{@tagName(val)}); } comptime { @@ -42,6 +43,7 @@ comptime { std.debug.assert(@TypeOf(@intFromEnum(Foo.e)) == Tag); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_error=main.zig:7:5: error: enumeration value '4' too large for type 'u2' #update=increase tag size #file=main.zig @@ -56,8 +58,9 @@ const Foo = enum(Tag) { pub fn main() !void { var val: Foo = undefined; val = .a; - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print("{s}\n", .{@tagName(val)}); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="a\n" diff --git a/test/incremental/change_exports b/test/incremental/change_exports index 0090d45d8ef791e382962925bb15bb74b40e510f..a36afb4ee1aae151871068cae685a93df61111f6 100644 --- a/test/incremental/change_exports +++ b/test/incremental/change_exports @@ -17,10 +17,11 @@ pub fn main() !void { extern const bar: u32; }; S.foo(); - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print("{}\n", .{S.bar}); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="123\n" #update=add conflict @@ -39,10 +40,11 @@ pub fn main() !void { extern const other: u32; }; S.foo(); - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other }); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_error=main.zig:6:5: error: exported symbol collision: foo #expect_error=main.zig:1:1: note: other symbol here @@ -62,10 +64,11 @@ pub fn main() !void { extern const other: u32; }; S.foo(); - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other }); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="123 456\n" #update=put exports in decl @@ -87,10 +90,11 @@ pub fn main() !void { extern const other: u32; }; S.foo(); - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other }); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="123 456\n" #update=remove reference to exporting decl @@ -133,10 +137,11 @@ pub fn main() !void { extern const other: u32; }; S.foo(); - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other }); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="123 456\n" #update=reintroduce reference to exporting decl, introducing conflict @@ -158,10 +163,11 @@ pub fn main() !void { extern const other: u32; }; S.foo(); - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other }); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_error=main.zig:5:5: error: exported symbol collision: bar #expect_error=main.zig:2:1: note: other symbol here #expect_error=main.zig:6:5: error: exported symbol collision: other diff --git a/test/incremental/change_fn_type b/test/incremental/change_fn_type index bcf006861ae828724c327edfcc356bfc3e250da0..b4286545e3816227d7d33354885875044c0b72fc 100644 --- a/test/incremental/change_fn_type +++ b/test/incremental/change_fn_type @@ -8,10 +8,11 @@ pub fn main() !void { try foo(123); } fn foo(x: u8) !void { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); return stdout_writer.interface.print("{d}\n", .{x}); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="123\n" #update=change function type @@ -20,10 +21,11 @@ pub fn main() !void { try foo(123); } fn foo(x: i64) !void { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); return stdout_writer.interface.print("{d}\n", .{x}); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="123\n" #update=change function argument @@ -32,8 +34,9 @@ pub fn main() !void { try foo(-42); } fn foo(x: i64) !void { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); return stdout_writer.interface.print("{d}\n", .{x}); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="-42\n" diff --git a/test/incremental/change_generic_line_number b/test/incremental/change_generic_line_number index 252261af6689469ef76161b4eeb7f8e1af910dba..2d731b071c644c35bf921e20187820d81660b3b1 100644 --- a/test/incremental/change_generic_line_number +++ b/test/incremental/change_generic_line_number @@ -4,10 +4,11 @@ #update=initial version #file=main.zig const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); fn Printer(message: []const u8) type { return struct { fn print() !void { - try std.Io.File.stdout().writeAll(message); + try std.Io.File.stdout().writeStreamingAll(io, message); } }; } @@ -19,11 +20,12 @@ pub fn main() !void { #update=change line number #file=main.zig const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); fn Printer(message: []const u8) type { return struct { fn print() !void { - try std.Io.File.stdout().writeAll(message); + try std.Io.File.stdout().writeStreamingAll(io, message); } }; } diff --git a/test/incremental/change_line_number b/test/incremental/change_line_number index a905745e6ad5a9f2076bb825b3d28c91af340778..7bafbbfbdd9d69538c094cbfbbfdaaf2b4f6a555 100644 --- a/test/incremental/change_line_number +++ b/test/incremental/change_line_number @@ -5,14 +5,16 @@ #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll("foo\n"); + try std.Io.File.stdout().writeStreamingAll(io, "foo\n"); } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="foo\n" #update=change line number #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll("foo\n"); + try std.Io.File.stdout().writeStreamingAll(io, "foo\n"); } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="foo\n" diff --git a/test/incremental/change_panic_handler b/test/incremental/change_panic_handler index 2fe9240b9b6d4283f1a034272058c72e59c77ab7..ebce3bc3121be81a04687dce2b77e7f27c39db4a 100644 --- a/test/incremental/change_panic_handler +++ b/test/incremental/change_panic_handler @@ -12,11 +12,12 @@ pub fn main() !u8 { } pub const panic = std.debug.FullPanic(myPanic); fn myPanic(msg: []const u8, _: ?usize) noreturn { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); stdout_writer.interface.print("panic message: {s}\n", .{msg}) catch {}; std.process.exit(0); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="panic message: integer overflow\n" #update=change the panic handler body @@ -29,11 +30,12 @@ pub fn main() !u8 { } pub const panic = std.debug.FullPanic(myPanic); fn myPanic(msg: []const u8, _: ?usize) noreturn { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); stdout_writer.interface.print("new panic message: {s}\n", .{msg}) catch {}; std.process.exit(0); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="new panic message: integer overflow\n" #update=change the panic handler function value @@ -46,9 +48,10 @@ pub fn main() !u8 { } pub const panic = std.debug.FullPanic(myPanicNew); fn myPanicNew(msg: []const u8, _: ?usize) noreturn { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); stdout_writer.interface.print("third panic message: {s}\n", .{msg}) catch {}; std.process.exit(0); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="third panic message: integer overflow\n" diff --git a/test/incremental/change_panic_handler_explicit b/test/incremental/change_panic_handler_explicit index 7daa851c8f9b186f7b7ac3acdaf2e90544d8fbed..366bffca45baab2478be62a00c90e780ef92597e 100644 --- a/test/incremental/change_panic_handler_explicit +++ b/test/incremental/change_panic_handler_explicit @@ -42,11 +42,12 @@ pub const panic = struct { pub const noreturnReturned = no_panic.noreturnReturned; }; fn myPanic(msg: []const u8, _: ?usize) noreturn { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); stdout_writer.interface.print("panic message: {s}\n", .{msg}) catch {}; std.process.exit(0); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="panic message: integer overflow\n" #update=change the panic handler body @@ -89,11 +90,12 @@ pub const panic = struct { pub const noreturnReturned = no_panic.noreturnReturned; }; fn myPanic(msg: []const u8, _: ?usize) noreturn { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); stdout_writer.interface.print("new panic message: {s}\n", .{msg}) catch {}; std.process.exit(0); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="new panic message: integer overflow\n" #update=change the panic handler function value @@ -136,9 +138,10 @@ pub const panic = struct { pub const noreturnReturned = no_panic.noreturnReturned; }; fn myPanicNew(msg: []const u8, _: ?usize) noreturn { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); stdout_writer.interface.print("third panic message: {s}\n", .{msg}) catch {}; std.process.exit(0); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="third panic message: integer overflow\n" diff --git a/test/incremental/change_shift_op b/test/incremental/change_shift_op index 557c17c0b1adffc9a8d606f7af40278ec6e05fd7..af849c0d5b6c28b3ee5a3d974ff9e74004f05ac0 100644 --- a/test/incremental/change_shift_op +++ b/test/incremental/change_shift_op @@ -9,10 +9,11 @@ pub fn main() !void { try foo(0x1300); } fn foo(x: u16) !void { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print("0x{x}\n", .{x << 4}); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="0x3000\n" #update=change to right shift #file=main.zig @@ -20,8 +21,9 @@ pub fn main() !void { try foo(0x1300); } fn foo(x: u16) !void { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print("0x{x}\n", .{x >> 4}); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="0x130\n" diff --git a/test/incremental/change_struct_same_fields b/test/incremental/change_struct_same_fields index ef8ffab52daa224c7ca48f0a642d3947b21c86cb..3ba715f906d087a34f5ce7f7aa5a81eb5012ce97 100644 --- a/test/incremental/change_struct_same_fields +++ b/test/incremental/change_struct_same_fields @@ -11,13 +11,14 @@ pub fn main() !void { try foo(&val); } fn foo(val: *const S) !void { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print( "{d} {d}\n", .{ val.x, val.y }, ); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="100 200\n" #update=change struct layout @@ -28,13 +29,14 @@ pub fn main() !void { try foo(&val); } fn foo(val: *const S) !void { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print( "{d} {d}\n", .{ val.x, val.y }, ); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="100 200\n" #update=change values @@ -45,11 +47,12 @@ pub fn main() !void { try foo(&val); } fn foo(val: *const S) !void { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print( "{d} {d}\n", .{ val.x, val.y }, ); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="1234 5678\n" diff --git a/test/incremental/change_zon_file b/test/incremental/change_zon_file index 8a4c69cf21327ddb3fa84ca44ed773d2b150aa70..a966df5471c270edd0e67568e930e3a91687f839 100644 --- a/test/incremental/change_zon_file +++ b/test/incremental/change_zon_file @@ -8,8 +8,9 @@ const std = @import("std"); const message: []const u8 = @import("message.zon"); pub fn main() !void { - try std.Io.File.stdout().writeAll(message); + try std.Io.File.stdout().writeStreamingAll(io, message); } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #file=message.zon "Hello, World!\n" #expect_stdout="Hello, World!\n" @@ -29,8 +30,9 @@ pub fn main() !void { const std = @import("std"); const message: []const u8 = @import("message.zon"); pub fn main() !void { - try std.Io.File.stdout().writeAll("a hardcoded string\n"); + try std.Io.File.stdout().writeStreamingAll(io, "a hardcoded string\n"); } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_error=message.zon:1:1: error: unable to load 'message.zon': FileNotFound #expect_error=main.zig:2:37: note: file imported here @@ -44,6 +46,7 @@ pub fn main() !void { const std = @import("std"); const message: []const u8 = @import("message.zon"); pub fn main() !void { - try std.Io.File.stdout().writeAll(message); + try std.Io.File.stdout().writeStreamingAll(io, message); } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="We're back, World!\n" diff --git a/test/incremental/change_zon_file_no_result_type b/test/incremental/change_zon_file_no_result_type index 2dd601765fcb944888942de439864b65e4a0511a..6b3aa73dc6ee87c6e0e64fb2eaeb56508b8c10c7 100644 --- a/test/incremental/change_zon_file_no_result_type +++ b/test/incremental/change_zon_file_no_result_type @@ -6,8 +6,9 @@ #update=initial version #file=main.zig const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); pub fn main() !void { - try std.Io.File.stdout().writeAll(@import("foo.zon").message); + try std.Io.File.stdout().writeStreamingAll(io, @import("foo.zon").message); } #file=foo.zon .{ diff --git a/test/incremental/compile_log b/test/incremental/compile_log index d52259f122c18c03f69ed4402b07462eefd09e7c..19ff7237f275a9cc946665ef1e8e08015d80bb56 100644 --- a/test/incremental/compile_log +++ b/test/incremental/compile_log @@ -8,17 +8,19 @@ #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n"); } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="Hello, World!\n" #update=add compile log #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n"); @compileLog("this is a log"); } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_error=main.zig:4:5: error: found compile log statement #expect_compile_log=@as(*const [13:0]u8, "this is a log") @@ -26,6 +28,7 @@ pub fn main() !void { #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n"); } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="Hello, World!\n" diff --git a/test/incremental/fix_astgen_failure b/test/incremental/fix_astgen_failure index 4dce2492e7f05244baa776b156b29d1564b62c54..dca371f521800d85e423cf68f008d78b598cfc97 100644 --- a/test/incremental/fix_astgen_failure +++ b/test/incremental/fix_astgen_failure @@ -10,28 +10,31 @@ pub fn main() !void { } #file=foo.zig pub fn hello() !void { - try std.Io.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n"); } #expect_error=foo.zig:2:9: error: use of undeclared identifier 'std' #update=fix the error #file=foo.zig const std = @import("std"); pub fn hello() !void { - try std.Io.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n"); } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="Hello, World!\n" #update=add new error #file=foo.zig const std = @import("std"); pub fn hello() !void { - try std.Io.File.stdout().writeAll(hello_str); + try std.Io.File.stdout().writeStreamingAll(io, hello_str); } -#expect_error=foo.zig:3:39: error: use of undeclared identifier 'hello_str' +const io = std.Io.Threaded.global_single_threaded.ioBasic(); +#expect_error=foo.zig:3:52: error: use of undeclared identifier 'hello_str' #update=fix the new error #file=foo.zig const std = @import("std"); const hello_str = "Hello, World! Again!\n"; pub fn hello() !void { - try std.Io.File.stdout().writeAll(hello_str); + try std.Io.File.stdout().writeStreamingAll(io, hello_str); } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="Hello, World! Again!\n" diff --git a/test/incremental/function_becomes_inline b/test/incremental/function_becomes_inline index 07cd98ef283ca5950985a6b2d0f93df99ac67bab..4021575842527a1c9705b411b634b354d44a6e04 100644 --- a/test/incremental/function_becomes_inline +++ b/test/incremental/function_becomes_inline @@ -8,9 +8,10 @@ pub fn main() !void { try foo(); } fn foo() !void { - try std.Io.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n"); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="Hello, World!\n" #update=make function inline @@ -19,9 +20,10 @@ pub fn main() !void { try foo(); } inline fn foo() !void { - try std.Io.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n"); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="Hello, World!\n" #update=change string @@ -30,7 +32,8 @@ pub fn main() !void { try foo(); } inline fn foo() !void { - try std.Io.File.stdout().writeAll("Hello, `inline` World!\n"); + try std.Io.File.stdout().writeStreamingAll(io, "Hello, `inline` World!\n"); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="Hello, `inline` World!\n" diff --git a/test/incremental/hello b/test/incremental/hello index 8ff8f61bc0cbb5ee9a040379e8a61be97927a55e..48659e1879ed97bad09ab32130401de4563c23cd 100644 --- a/test/incremental/hello +++ b/test/incremental/hello @@ -6,14 +6,16 @@ #update=initial version #file=main.zig const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); pub fn main() !void { - try std.Io.File.stdout().writeAll("good morning\n"); + try std.Io.File.stdout().writeStreamingAll(io, "good morning\n"); } #expect_stdout="good morning\n" #update=change the string #file=main.zig const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); pub fn main() !void { - try std.Io.File.stdout().writeAll("おはようございます\n"); + try std.Io.File.stdout().writeStreamingAll(io, "おはようございます\n"); } #expect_stdout="おはようございます\n" diff --git a/test/incremental/make_decl_pub b/test/incremental/make_decl_pub index 9d90ca51ebc2322671c670fd9896e09087ad694c..b193deb68cf07f5c4709eb42da2a65d2997e4d92 100644 --- a/test/incremental/make_decl_pub +++ b/test/incremental/make_decl_pub @@ -12,8 +12,9 @@ pub fn main() !void { #file=foo.zig const std = @import("std"); fn hello() !void { - try std.Io.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n"); } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_error=main.zig:3:12: error: 'hello' is not marked 'pub' #expect_error=foo.zig:2:1: note: declared here @@ -21,6 +22,7 @@ fn hello() !void { #file=foo.zig const std = @import("std"); pub fn hello() !void { - try std.Io.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeStreamingAll(io, "Hello, World!\n"); } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="Hello, World!\n" diff --git a/test/incremental/modify_inline_fn b/test/incremental/modify_inline_fn index 2c1478682ed7255cb85e478847913b0d3311b482..19e201f1d9e2e994c8ff65c4fe780e96d8c818b0 100644 --- a/test/incremental/modify_inline_fn +++ b/test/incremental/modify_inline_fn @@ -8,20 +8,22 @@ const std = @import("std"); pub fn main() !void { const str = getStr(); - try std.Io.File.stdout().writeAll(str); + try std.Io.File.stdout().writeStreamingAll(io, str); } inline fn getStr() []const u8 { return "foo\n"; } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="foo\n" #update=change the string #file=main.zig const std = @import("std"); pub fn main() !void { const str = getStr(); - try std.Io.File.stdout().writeAll(str); + try std.Io.File.stdout().writeStreamingAll(io, str); } inline fn getStr() []const u8 { return "bar\n"; } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="bar\n" diff --git a/test/incremental/move_src b/test/incremental/move_src index d6a21fc562730a05aec5ecbfb4c8541d6a651257..b79a25df8df11002a6d4e7b1bf78c976ea760372 100644 --- a/test/incremental/move_src +++ b/test/incremental/move_src @@ -7,7 +7,7 @@ #file=main.zig const std = @import("std"); pub fn main() !void { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print("{d} {d}\n", .{ foo(), bar() }); } fn foo() u32 { @@ -16,13 +16,14 @@ fn foo() u32 { fn bar() u32 { return 123; } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="7 123\n" #update=add newline #file=main.zig const std = @import("std"); pub fn main() !void { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print("{d} {d}\n", .{ foo(), bar() }); } @@ -32,4 +33,5 @@ fn foo() u32 { fn bar() u32 { return 123; } +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="8 123\n" diff --git a/test/incremental/no_change_preserves_tag_names b/test/incremental/no_change_preserves_tag_names index 6675d74166016b849c93aaf5663d6d6354770070..dc89face50dbf5acbe8be6f50dddeedac323d3d7 100644 --- a/test/incremental/no_change_preserves_tag_names +++ b/test/incremental/no_change_preserves_tag_names @@ -7,15 +7,17 @@ #file=main.zig const std = @import("std"); var some_enum: enum { first, second } = .first; +const io = std.Io.Threaded.global_single_threaded.ioBasic(); pub fn main() !void { - try std.Io.File.stdout().writeStreamingAll(std.Io.Threaded.global_single_threaded.ioBasic(), @tagName(some_enum)); + try std.Io.File.stdout().writeStreamingAll(io, @tagName(some_enum)); } #expect_stdout="first" #update=no change #file=main.zig const std = @import("std"); var some_enum: enum { first, second } = .first; +const io = std.Io.Threaded.global_single_threaded.ioBasic(); pub fn main() !void { - try std.Io.File.stdout().writeStreamingAll(std.Io.Threaded.global_single_threaded.ioBasic(), @tagName(some_enum)); + try std.Io.File.stdout().writeStreamingAll(io, @tagName(some_enum)); } #expect_stdout="first" diff --git a/test/incremental/recursive_function_becomes_non_recursive b/test/incremental/recursive_function_becomes_non_recursive index 20e43b64b717d1507c151c446560ce37616b9719..5cee1bfbcff10ab669ee367e80a833d800df1cc6 100644 --- a/test/incremental/recursive_function_becomes_non_recursive +++ b/test/incremental/recursive_function_becomes_non_recursive @@ -11,9 +11,10 @@ pub fn main() !void { fn foo(recurse: bool) !void { const stdout = std.Io.File.stdout(); if (recurse) return foo(true); - try stdout.writeAll("non-recursive path\n"); + try stdout.writeStreamingAll(io, "non-recursive path\n"); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="non-recursive path\n" #update=eliminate recursion and change argument @@ -23,8 +24,9 @@ pub fn main() !void { } fn foo(recurse: bool) !void { const stdout = std.Io.File.stdout(); - if (recurse) return stdout.writeAll("x==1\n"); - try stdout.writeAll("non-recursive path\n"); + if (recurse) return stdout.writeStreamingAll(io, "x==1\n"); + try stdout.writeStreamingAll(io, "non-recursive path\n"); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="x==1\n" diff --git a/test/incremental/remove_enum_field b/test/incremental/remove_enum_field index bbcf7718e9c8a69cf675d163de898af972468db5..c964285707dec13202b9b917e390b6c90bf509ad 100644 --- a/test/incremental/remove_enum_field +++ b/test/incremental/remove_enum_field @@ -10,10 +10,11 @@ const MyEnum = enum(u8) { bar = 2, }; pub fn main() !void { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print("{}\n", .{@intFromEnum(MyEnum.foo)}); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="1\n" #update=remove enum field #file=main.zig @@ -22,9 +23,10 @@ const MyEnum = enum(u8) { bar = 2, }; pub fn main() !void { - var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); try stdout_writer.interface.print("{}\n", .{@intFromEnum(MyEnum.foo)}); } const std = @import("std"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_error=main.zig:7:69: error: enum 'main.MyEnum' has no member named 'foo' #expect_error=main.zig:1:16: note: enum declared here diff --git a/test/incremental/unreferenced_error b/test/incremental/unreferenced_error index 1c1f1f7a8fbd5f8a3d738645cda6b4da1890043c..c9a3277487c103a656a2b72fcb702fab27862856 100644 --- a/test/incremental/unreferenced_error +++ b/test/incremental/unreferenced_error @@ -7,36 +7,40 @@ #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll(a); + try std.Io.File.stdout().writeStreamingAll(io, a); } const a = "Hello, World!\n"; +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="Hello, World!\n" #update=introduce compile error #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll(a); + try std.Io.File.stdout().writeStreamingAll(io, a); } const a = @compileError("bad a"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_error=main.zig:5:11: error: bad a #update=remove error reference #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll(b); + try std.Io.File.stdout().writeStreamingAll(io, b); } const a = @compileError("bad a"); const b = "Hi there!\n"; +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="Hi there!\n" #update=introduce and remove reference to error #file=main.zig const std = @import("std"); pub fn main() !void { - try std.Io.File.stdout().writeAll(a); + try std.Io.File.stdout().writeStreamingAll(io, a); } const a = "Back to a\n"; const b = @compileError("bad b"); +const io = std.Io.Threaded.global_single_threaded.ioBasic(); #expect_stdout="Back to a\n" -- 2.54.0