update standalone and incremental tests to new API

This commit is contained in:
Andrew Kelley
2025-07-07 19:33:20 -07:00
parent c873c2eed9
commit d8e26275f2
72 changed files with 347 additions and 892 deletions

View File

@@ -4,8 +4,11 @@ const std = @import("std");
var buffer: [0x1000000]u64 = [1]u64{0} ** 0x1000000;
pub fn main() anyerror!void {
var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
buffer[0x10] = 1;
try std.io.getStdOut().writer().print("{d}, {d}, {d}\n", .{
try stdout_writer.interface.print("{d}, {d}, {d}\n", .{
// workaround the dreaded decl_val
(&buffer)[0],
(&buffer)[0x10],

View File

@@ -1315,8 +1315,8 @@ fn testGcSectionsZig(b: *Build, opts: Options) *Step {
\\extern var live_var2: i32;
\\extern fn live_fn2() void;
\\pub fn main() void {
\\ const stdout = std.io.getStdOut();
\\ stdout.deprecatedWriter().print("{d} {d}\n", .{ live_var1, live_var2 }) catch unreachable;
\\ var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
\\ stdout_writer.interface.print("{d} {d}\n", .{ live_var1, live_var2 }) catch @panic("fail");
\\ live_fn2();
\\}
,
@@ -1357,8 +1357,8 @@ fn testGcSectionsZig(b: *Build, opts: Options) *Step {
\\extern var live_var2: i32;
\\extern fn live_fn2() void;
\\pub fn main() void {
\\ const stdout = std.io.getStdOut();
\\ stdout.deprecatedWriter().print("{d} {d}\n", .{ live_var1, live_var2 }) catch unreachable;
\\ var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
\\ stdout_writer.interface.print("{d} {d}\n", .{ live_var1, live_var2 }) catch @panic("fail");
\\ live_fn2();
\\}
,

View File

@@ -710,7 +710,7 @@ fn testHelloZig(b: *Build, opts: Options) *Step {
const exe = addExecutable(b, opts, .{ .name = "main", .zig_source_bytes =
\\const std = @import("std");
\\pub fn main() void {
\\ std.io.getStdOut().writer().print("Hello world!\n", .{}) catch unreachable;
\\ std.fs.File.stdout().writeAll("Hello world!\n") catch @panic("fail");
\\}
});
@@ -2365,10 +2365,11 @@ fn testTlsZig(b: *Build, opts: Options) *Step {
\\threadlocal var x: i32 = 0;
\\threadlocal var y: i32 = -1;
\\pub fn main() void {
\\ std.io.getStdOut().writer().print("{d} {d}\n", .{x, y}) catch unreachable;
\\ var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
\\ stdout_writer.interface.print("{d} {d}\n", .{x, y}) catch unreachable;
\\ x -= 1;
\\ y += 1;
\\ std.io.getStdOut().writer().print("{d} {d}\n", .{x, y}) catch unreachable;
\\ stdout_writer.interface.print("{d} {d}\n", .{x, y}) catch unreachable;
\\}
});

View File

@@ -3,6 +3,6 @@ const std = @import("std");
extern const foo: u32;
pub fn main() void {
const std_out = std.io.getStdOut();
std_out.writer().print("Result: {d}", .{foo}) catch {};
var stdout_writer = std.fs.File.stdout().writerStreaming(&.{});
stdout_writer.interface.print("Result: {d}", .{foo}) catch {};
}