authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-22 20:55:47-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-23 22:15:12-08:00
log6ece10f63d91cfa16d8388f8d696368537c1662e
tree15aace22978455db73c29736606165589a312ee3
parente9da2783ce3c65d8e8e8533b7c70ec5a867f830a

update test-link to new std.Io API


9 files changed, 29 insertions(+), 10 deletions(-)

test/link/bss/main.zig+1-1
......@@ -4,7 +4,7 @@ const std = @import("std");
44var buffer: [0x1000000]u64 = [1]u64{0} ** 0x1000000;
55
66pub fn main() anyerror!void {
7 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
7 var stdout_writer = std.Io.File.stdout().writerStreaming(std.Options.debug_io, &.{});
88
99 buffer[0x10] = 1;
1010
test/link/elf.zig+2-2
......@@ -1323,7 +1323,7 @@ fn testGcSectionsZig(b: *Build, opts: Options) *Step {
13231323 \\extern var live_var2: i32;
13241324 \\extern fn live_fn2() void;
13251325 \\pub fn main() void {
1326 \\ var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
1326 \\ var stdout_writer = std.Io.File.stdout().writerStreaming(std.Options.debug_io, &.{});
13271327 \\ stdout_writer.interface.print("{d} {d}\n", .{ live_var1, live_var2 }) catch @panic("fail");
13281328 \\ live_fn2();
13291329 \\}
......@@ -1365,7 +1365,7 @@ fn testGcSectionsZig(b: *Build, opts: Options) *Step {
13651365 \\extern var live_var2: i32;
13661366 \\extern fn live_fn2() void;
13671367 \\pub fn main() void {
1368 \\ var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
1368 \\ var stdout_writer = std.Io.File.stdout().writerStreaming(std.Options.debug_io, &.{});
13691369 \\ stdout_writer.interface.print("{d} {d}\n", .{ live_var1, live_var2 }) catch @panic("fail");
13701370 \\ live_fn2();
13711371 \\}
test/link/macho.zig+2-2
......@@ -716,7 +716,7 @@ fn testHelloZig(b: *Build, opts: Options) *Step {
716716 const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes =
717717 \\const std = @import("std");
718718 \\pub fn main() void {
719 \\ std.Io.File.stdout().writeAll("Hello world!\n") catch @panic("fail");
719 \\ std.Io.File.stdout().writeStreamingAll(std.Options.debug_io, "Hello world!\n") catch @panic("fail");
720720 \\}
721721 });
722722
......@@ -2372,7 +2372,7 @@ fn testTlsZig(b: *Build, opts: Options) *Step {
23722372 \\threadlocal var x: i32 = 0;
23732373 \\threadlocal var y: i32 = -1;
23742374 \\pub fn main() void {
2375 \\ var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
2375 \\ var stdout_writer = std.Io.File.stdout().writerStreaming(std.Options.debug_io, &.{});
23762376 \\ stdout_writer.interface.print("{d} {d}\n", .{x, y}) catch unreachable;
23772377 \\ x -= 1;
23782378 \\ y += 1;
test/link/wasm/extern/main.zig+1-1
......@@ -3,6 +3,6 @@ const std = @import("std");
33extern const foo: u32;
44
55pub fn main() void {
6 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
6 var stdout_writer = std.Io.File.stdout().writerStreaming(std.Options.debug_io, &.{});
77 stdout_writer.interface.print("Result: {d}", .{foo}) catch {};
88}
test/standalone/simple/guess_number/main.zig+11-1
......@@ -1,8 +1,18 @@
11const builtin = @import("builtin");
22const std = @import("std");
33
4// See https://github.com/ziglang/zig/issues/24510
5// for the plan to simplify this code.
46pub fn main() !void {
5 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
7 var debug_allocator: std.heap.DebugAllocator(.{}) = .init;
8 defer _ = debug_allocator.deinit();
9 const gpa = debug_allocator.allocator();
10
11 var threaded: std.Io.Threaded = .init(gpa, .{});
12 defer threaded.deinit();
13 const io = threaded.io();
14
15 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
616 const out = &stdout_writer.interface;
717 const stdin: std.Io.File = .stdin();
818
test/standalone/simple/hello_world/hello.zig+2
......@@ -1,5 +1,7 @@
11const std = @import("std");
22
3// See https://github.com/ziglang/zig/issues/24510
4// for the plan to simplify this code.
35pub fn main() !void {
46 var debug_allocator: std.heap.DebugAllocator(.{}) = .init;
57 defer _ = debug_allocator.deinit();
test/standalone/windows_bat_args/echo-args.zig+3-1
......@@ -5,7 +5,9 @@ pub fn main() !void {
55 defer arena_state.deinit();
66 const arena = arena_state.allocator();
77
8 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
8 const io = std.Options.debug_io;
9
10 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
911 const stdout = &stdout_writer.interface;
1012 var args = try std.process.argsAlloc(arena);
1113 for (args[1..], 1..) |arg, i| {
test/standalone/windows_paths/relative.zig+5-1
......@@ -10,10 +10,14 @@ pub fn main() !void {
1010
1111 if (args.len < 3) return error.MissingArgs;
1212
13 var threaded: std.Io.Threaded = .init(allocator, .{});
14 defer threaded.deinit();
15 const io = threaded.io();
16
1317 const relative = try std.fs.path.relative(allocator, args[1], args[2]);
1418 defer allocator.free(relative);
1519
16 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
20 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
1721 const stdout = &stdout_writer.interface;
1822 try stdout.writeAll(relative);
1923}
test/standalone/windows_spawn/hello.zig+2-1
......@@ -1,7 +1,8 @@
11const std = @import("std");
22
33pub fn main() !void {
4 var stdout_writer = std.Io.File.stdout().writerStreaming(&.{});
4 const io = std.Options.debug_io;
5 var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
56 const stdout = &stdout_writer.interface;
67 try stdout.writeAll("hello from exe\n");
78}