diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-12-08 18:07:55 -0800 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-12-23 22:15:08 -0800 |
| commit | a91c6dc71d42ea59ec53ce4e0ae83e4970731313 (patch) | |
| tree | 815a549f1f16d6c6ce37d6f2d3034c484bb18ca9 | |
| parent | 1dcfc8787e86ed94d216976e621a49fc488e8214 (diff) | |
| download | zig-a91c6dc71d42ea59ec53ce4e0ae83e4970731313.tar.gz zig-a91c6dc71d42ea59ec53ce4e0ae83e4970731313.zip | |
test: std.fs.File -> std.Io.File
43 files changed, 106 insertions, 102 deletions
diff --git a/test/cases/disable_stack_tracing.zig b/test/cases/disable_stack_tracing.zig index 044eaf7012..5b394beeeb 100644 --- a/test/cases/disable_stack_tracing.zig +++ b/test/cases/disable_stack_tracing.zig @@ -5,7 +5,7 @@ pub const std_options: std.Options = .{ pub fn main() !void { var st_buf: [8]usize = undefined; var buf: [1024]u8 = undefined; - var stdout = std.fs.File.stdout().writer(&buf); + var stdout = std.Io.File.stdout().writer(&buf); const captured_st = try foo(&stdout.interface, &st_buf); try std.debug.writeStackTrace(&captured_st, &stdout.interface, .no_color); diff --git a/test/incremental/add_decl b/test/incremental/add_decl index 9efd274b9e..031085ca58 100644 --- a/test/incremental/add_decl +++ b/test/incremental/add_decl @@ -7,7 +7,7 @@ #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll(foo); + try std.Io.File.stdout().writeAll(foo); } const foo = "good morning\n"; #expect_stdout="good morning\n" @@ -16,7 +16,7 @@ const foo = "good morning\n"; #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll(foo); + try std.Io.File.stdout().writeAll(foo); } const foo = "good morning\n"; const bar = "good evening\n"; @@ -26,7 +26,7 @@ const bar = "good evening\n"; #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll(bar); + try std.Io.File.stdout().writeAll(bar); } const foo = "good morning\n"; const bar = "good evening\n"; @@ -36,7 +36,7 @@ const bar = "good evening\n"; #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll(qux); + try std.Io.File.stdout().writeAll(qux); } const foo = "good morning\n"; const bar = "good evening\n"; @@ -46,7 +46,7 @@ const bar = "good evening\n"; #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll(qux); + try std.Io.File.stdout().writeAll(qux); } const foo = "good morning\n"; const bar = "good evening\n"; @@ -57,7 +57,7 @@ const qux = "good night\n"; #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll(qux); + try std.Io.File.stdout().writeAll(qux); } const qux = "good night\n"; #expect_stdout="good night\n" diff --git a/test/incremental/add_decl_namespaced b/test/incremental/add_decl_namespaced index 1025ae24e1..cbeaf4865e 100644 --- a/test/incremental/add_decl_namespaced +++ b/test/incremental/add_decl_namespaced @@ -7,7 +7,7 @@ #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll(@This().foo); + try std.Io.File.stdout().writeAll(@This().foo); } const foo = "good morning\n"; #expect_stdout="good morning\n" @@ -16,7 +16,7 @@ const foo = "good morning\n"; #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll(@This().foo); + try std.Io.File.stdout().writeAll(@This().foo); } const foo = "good morning\n"; const bar = "good evening\n"; @@ -26,7 +26,7 @@ const bar = "good evening\n"; #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll(@This().bar); + try std.Io.File.stdout().writeAll(@This().bar); } const foo = "good morning\n"; const bar = "good evening\n"; @@ -36,7 +36,7 @@ const bar = "good evening\n"; #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll(@This().qux); + try std.Io.File.stdout().writeAll(@This().qux); } const foo = "good morning\n"; const bar = "good evening\n"; @@ -47,7 +47,7 @@ const bar = "good evening\n"; #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll(@This().qux); + try std.Io.File.stdout().writeAll(@This().qux); } const foo = "good morning\n"; const bar = "good evening\n"; @@ -58,7 +58,7 @@ const qux = "good night\n"; #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll(@This().qux); + try std.Io.File.stdout().writeAll(@This().qux); } const qux = "good night\n"; #expect_stdout="good night\n" diff --git a/test/incremental/bad_import b/test/incremental/bad_import index 9b6be8b176..ad66c17b5b 100644 --- a/test/incremental/bad_import +++ b/test/incremental/bad_import @@ -8,7 +8,7 @@ #file=main.zig pub fn main() !void { _ = @import("foo.zig"); - try std.fs.File.stdout().writeAll("success\n"); + try std.Io.File.stdout().writeAll("success\n"); } const std = @import("std"); #file=foo.zig @@ -30,7 +30,7 @@ comptime { #file=main.zig pub fn main() !void { //_ = @import("foo.zig"); - try std.fs.File.stdout().writeAll("success\n"); + try std.Io.File.stdout().writeAll("success\n"); } const std = @import("std"); #expect_stdout="success\n" diff --git a/test/incremental/change_embed_file b/test/incremental/change_embed_file index 85d861ab93..1eed90dc32 100644 --- a/test/incremental/change_embed_file +++ b/test/incremental/change_embed_file @@ -8,7 +8,7 @@ const std = @import("std"); const string = @embedFile("string.txt"); pub fn main() !void { - try std.fs.File.stdout().writeAll(string); + try std.Io.File.stdout().writeAll(string); } #file=string.txt Hello, World! @@ -28,7 +28,7 @@ Hello again, World! const std = @import("std"); const string = @embedFile("string.txt"); pub fn main() !void { - try std.fs.File.stdout().writeAll("a hardcoded string\n"); + try std.Io.File.stdout().writeAll("a hardcoded string\n"); } #expect_stdout="a hardcoded string\n" @@ -37,7 +37,7 @@ pub fn main() !void { const std = @import("std"); const string = @embedFile("string.txt"); pub fn main() !void { - try std.fs.File.stdout().writeAll(string); + try std.Io.File.stdout().writeAll(string); } #expect_error=main.zig:2:27: error: unable to open 'string.txt': FileNotFound diff --git a/test/incremental/change_enum_tag_type b/test/incremental/change_enum_tag_type index 906f910271..6e72b3e573 100644 --- a/test/incremental/change_enum_tag_type +++ b/test/incremental/change_enum_tag_type @@ -15,7 +15,7 @@ const Foo = enum(Tag) { pub fn main() !void { var val: Foo = undefined; val = .a; - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print("{s}\n", .{@tagName(val)}); } const std = @import("std"); @@ -33,7 +33,7 @@ const Foo = enum(Tag) { pub fn main() !void { var val: Foo = undefined; val = .a; - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print("{s}\n", .{@tagName(val)}); } comptime { @@ -56,7 +56,7 @@ const Foo = enum(Tag) { pub fn main() !void { var val: Foo = undefined; val = .a; - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print("{s}\n", .{@tagName(val)}); } const std = @import("std"); diff --git a/test/incremental/change_exports b/test/incremental/change_exports index b0850626d6..0090d45d8e 100644 --- a/test/incremental/change_exports +++ b/test/incremental/change_exports @@ -17,7 +17,7 @@ pub fn main() !void { extern const bar: u32; }; S.foo(); - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print("{}\n", .{S.bar}); } const std = @import("std"); @@ -39,7 +39,7 @@ pub fn main() !void { extern const other: u32; }; S.foo(); - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other }); } const std = @import("std"); @@ -62,7 +62,7 @@ pub fn main() !void { extern const other: u32; }; S.foo(); - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other }); } const std = @import("std"); @@ -87,7 +87,7 @@ pub fn main() !void { extern const other: u32; }; S.foo(); - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other }); } const std = @import("std"); @@ -133,7 +133,7 @@ pub fn main() !void { extern const other: u32; }; S.foo(); - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other }); } const std = @import("std"); @@ -158,7 +158,7 @@ pub fn main() !void { extern const other: u32; }; S.foo(); - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print("{} {}\n", .{ S.bar, S.other }); } const std = @import("std"); diff --git a/test/incremental/change_fn_type b/test/incremental/change_fn_type index df788684cd..bcf006861a 100644 --- a/test/incremental/change_fn_type +++ b/test/incremental/change_fn_type @@ -8,7 +8,7 @@ pub fn main() !void { try foo(123); } fn foo(x: u8) !void { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); return stdout_writer.interface.print("{d}\n", .{x}); } const std = @import("std"); @@ -20,7 +20,7 @@ pub fn main() !void { try foo(123); } fn foo(x: i64) !void { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); return stdout_writer.interface.print("{d}\n", .{x}); } const std = @import("std"); @@ -32,7 +32,7 @@ pub fn main() !void { try foo(-42); } fn foo(x: i64) !void { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); return stdout_writer.interface.print("{d}\n", .{x}); } const std = @import("std"); diff --git a/test/incremental/change_generic_line_number b/test/incremental/change_generic_line_number index f1920c67e6..252261af66 100644 --- a/test/incremental/change_generic_line_number +++ b/test/incremental/change_generic_line_number @@ -7,7 +7,7 @@ const std = @import("std"); fn Printer(message: []const u8) type { return struct { fn print() !void { - try std.fs.File.stdout().writeAll(message); + try std.Io.File.stdout().writeAll(message); } }; } @@ -23,7 +23,7 @@ const std = @import("std"); fn Printer(message: []const u8) type { return struct { fn print() !void { - try std.fs.File.stdout().writeAll(message); + try std.Io.File.stdout().writeAll(message); } }; } diff --git a/test/incremental/change_line_number b/test/incremental/change_line_number index 5c809b8fa9..a905745e6a 100644 --- a/test/incremental/change_line_number +++ b/test/incremental/change_line_number @@ -5,7 +5,7 @@ #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll("foo\n"); + try std.Io.File.stdout().writeAll("foo\n"); } #expect_stdout="foo\n" #update=change line number @@ -13,6 +13,6 @@ pub fn main() !void { const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll("foo\n"); + try std.Io.File.stdout().writeAll("foo\n"); } #expect_stdout="foo\n" diff --git a/test/incremental/change_panic_handler b/test/incremental/change_panic_handler index 070384887a..2fe9240b9b 100644 --- a/test/incremental/change_panic_handler +++ b/test/incremental/change_panic_handler @@ -12,7 +12,7 @@ pub fn main() !u8 { } pub const panic = std.debug.FullPanic(myPanic); fn myPanic(msg: []const u8, _: ?usize) noreturn { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); stdout_writer.interface.print("panic message: {s}\n", .{msg}) catch {}; std.process.exit(0); } @@ -29,7 +29,7 @@ pub fn main() !u8 { } pub const panic = std.debug.FullPanic(myPanic); fn myPanic(msg: []const u8, _: ?usize) noreturn { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); stdout_writer.interface.print("new panic message: {s}\n", .{msg}) catch {}; std.process.exit(0); } @@ -46,7 +46,7 @@ pub fn main() !u8 { } pub const panic = std.debug.FullPanic(myPanicNew); fn myPanicNew(msg: []const u8, _: ?usize) noreturn { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); stdout_writer.interface.print("third panic message: {s}\n", .{msg}) catch {}; std.process.exit(0); } diff --git a/test/incremental/change_panic_handler_explicit b/test/incremental/change_panic_handler_explicit index 774b18bbfd..7daa851c8f 100644 --- a/test/incremental/change_panic_handler_explicit +++ b/test/incremental/change_panic_handler_explicit @@ -42,7 +42,7 @@ pub const panic = struct { pub const noreturnReturned = no_panic.noreturnReturned; }; fn myPanic(msg: []const u8, _: ?usize) noreturn { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); stdout_writer.interface.print("panic message: {s}\n", .{msg}) catch {}; std.process.exit(0); } @@ -89,7 +89,7 @@ pub const panic = struct { pub const noreturnReturned = no_panic.noreturnReturned; }; fn myPanic(msg: []const u8, _: ?usize) noreturn { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); stdout_writer.interface.print("new panic message: {s}\n", .{msg}) catch {}; std.process.exit(0); } @@ -136,7 +136,7 @@ pub const panic = struct { pub const noreturnReturned = no_panic.noreturnReturned; }; fn myPanicNew(msg: []const u8, _: ?usize) noreturn { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); stdout_writer.interface.print("third panic message: {s}\n", .{msg}) catch {}; std.process.exit(0); } diff --git a/test/incremental/change_shift_op b/test/incremental/change_shift_op index 41b5d19266..557c17c0b1 100644 --- a/test/incremental/change_shift_op +++ b/test/incremental/change_shift_op @@ -9,7 +9,7 @@ pub fn main() !void { try foo(0x1300); } fn foo(x: u16) !void { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print("0x{x}\n", .{x << 4}); } const std = @import("std"); @@ -20,7 +20,7 @@ pub fn main() !void { try foo(0x1300); } fn foo(x: u16) !void { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print("0x{x}\n", .{x >> 4}); } const std = @import("std"); diff --git a/test/incremental/change_struct_same_fields b/test/incremental/change_struct_same_fields index 7af1161326..ef8ffab52d 100644 --- a/test/incremental/change_struct_same_fields +++ b/test/incremental/change_struct_same_fields @@ -11,7 +11,7 @@ pub fn main() !void { try foo(&val); } fn foo(val: *const S) !void { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print( "{d} {d}\n", .{ val.x, val.y }, @@ -28,7 +28,7 @@ pub fn main() !void { try foo(&val); } fn foo(val: *const S) !void { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print( "{d} {d}\n", .{ val.x, val.y }, @@ -45,7 +45,7 @@ pub fn main() !void { try foo(&val); } fn foo(val: *const S) !void { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print( "{d} {d}\n", .{ val.x, val.y }, diff --git a/test/incremental/change_zon_file b/test/incremental/change_zon_file index 62f73dd3bf..8a4c69cf21 100644 --- a/test/incremental/change_zon_file +++ b/test/incremental/change_zon_file @@ -8,7 +8,7 @@ const std = @import("std"); const message: []const u8 = @import("message.zon"); pub fn main() !void { - try std.fs.File.stdout().writeAll(message); + try std.Io.File.stdout().writeAll(message); } #file=message.zon "Hello, World!\n" @@ -29,7 +29,7 @@ pub fn main() !void { const std = @import("std"); const message: []const u8 = @import("message.zon"); pub fn main() !void { - try std.fs.File.stdout().writeAll("a hardcoded string\n"); + try std.Io.File.stdout().writeAll("a hardcoded string\n"); } #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 +44,6 @@ pub fn main() !void { const std = @import("std"); const message: []const u8 = @import("message.zon"); pub fn main() !void { - try std.fs.File.stdout().writeAll(message); + try std.Io.File.stdout().writeAll(message); } #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 498543e4f1..2dd601765f 100644 --- a/test/incremental/change_zon_file_no_result_type +++ b/test/incremental/change_zon_file_no_result_type @@ -7,7 +7,7 @@ #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll(@import("foo.zon").message); + try std.Io.File.stdout().writeAll(@import("foo.zon").message); } #file=foo.zon .{ diff --git a/test/incremental/compile_log b/test/incremental/compile_log index 697bb26569..d52259f122 100644 --- a/test/incremental/compile_log +++ b/test/incremental/compile_log @@ -8,7 +8,7 @@ #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeAll("Hello, World!\n"); } #expect_stdout="Hello, World!\n" @@ -16,7 +16,7 @@ pub fn main() !void { #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeAll("Hello, World!\n"); @compileLog("this is a log"); } #expect_error=main.zig:4:5: error: found compile log statement @@ -26,6 +26,6 @@ pub fn main() !void { #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeAll("Hello, World!\n"); } #expect_stdout="Hello, World!\n" diff --git a/test/incremental/fix_astgen_failure b/test/incremental/fix_astgen_failure index 8b1b3adbf7..4dce2492e7 100644 --- a/test/incremental/fix_astgen_failure +++ b/test/incremental/fix_astgen_failure @@ -10,21 +10,21 @@ pub fn main() !void { } #file=foo.zig pub fn hello() !void { - try std.fs.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeAll("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.fs.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeAll("Hello, World!\n"); } #expect_stdout="Hello, World!\n" #update=add new error #file=foo.zig const std = @import("std"); pub fn hello() !void { - try std.fs.File.stdout().writeAll(hello_str); + try std.Io.File.stdout().writeAll(hello_str); } #expect_error=foo.zig:3:39: error: use of undeclared identifier 'hello_str' #update=fix the new error @@ -32,6 +32,6 @@ pub fn hello() !void { const std = @import("std"); const hello_str = "Hello, World! Again!\n"; pub fn hello() !void { - try std.fs.File.stdout().writeAll(hello_str); + try std.Io.File.stdout().writeAll(hello_str); } #expect_stdout="Hello, World! Again!\n" diff --git a/test/incremental/function_becomes_inline b/test/incremental/function_becomes_inline index 240d7a54af..07cd98ef28 100644 --- a/test/incremental/function_becomes_inline +++ b/test/incremental/function_becomes_inline @@ -8,7 +8,7 @@ pub fn main() !void { try foo(); } fn foo() !void { - try std.fs.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeAll("Hello, World!\n"); } const std = @import("std"); #expect_stdout="Hello, World!\n" @@ -19,7 +19,7 @@ pub fn main() !void { try foo(); } inline fn foo() !void { - try std.fs.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeAll("Hello, World!\n"); } const std = @import("std"); #expect_stdout="Hello, World!\n" @@ -30,7 +30,7 @@ pub fn main() !void { try foo(); } inline fn foo() !void { - try std.fs.File.stdout().writeAll("Hello, `inline` World!\n"); + try std.Io.File.stdout().writeAll("Hello, `inline` World!\n"); } const std = @import("std"); #expect_stdout="Hello, `inline` World!\n" diff --git a/test/incremental/hello b/test/incremental/hello index dc6f02177f..8ff8f61bc0 100644 --- a/test/incremental/hello +++ b/test/incremental/hello @@ -7,13 +7,13 @@ #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll("good morning\n"); + try std.Io.File.stdout().writeAll("good morning\n"); } #expect_stdout="good morning\n" #update=change the string #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll("おはようございます\n"); + try std.Io.File.stdout().writeAll("おはようございます\n"); } #expect_stdout="おはようございます\n" diff --git a/test/incremental/make_decl_pub b/test/incremental/make_decl_pub index b25b117160..9d90ca51eb 100644 --- a/test/incremental/make_decl_pub +++ b/test/incremental/make_decl_pub @@ -12,7 +12,7 @@ pub fn main() !void { #file=foo.zig const std = @import("std"); fn hello() !void { - try std.fs.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeAll("Hello, World!\n"); } #expect_error=main.zig:3:12: error: 'hello' is not marked 'pub' #expect_error=foo.zig:2:1: note: declared here @@ -21,6 +21,6 @@ fn hello() !void { #file=foo.zig const std = @import("std"); pub fn hello() !void { - try std.fs.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeAll("Hello, World!\n"); } #expect_stdout="Hello, World!\n" diff --git a/test/incremental/modify_inline_fn b/test/incremental/modify_inline_fn index d485d8ffd5..2c1478682e 100644 --- a/test/incremental/modify_inline_fn +++ b/test/incremental/modify_inline_fn @@ -8,7 +8,7 @@ const std = @import("std"); pub fn main() !void { const str = getStr(); - try std.fs.File.stdout().writeAll(str); + try std.Io.File.stdout().writeAll(str); } inline fn getStr() []const u8 { return "foo\n"; @@ -19,7 +19,7 @@ inline fn getStr() []const u8 { const std = @import("std"); pub fn main() !void { const str = getStr(); - try std.fs.File.stdout().writeAll(str); + try std.Io.File.stdout().writeAll(str); } inline fn getStr() []const u8 { return "bar\n"; diff --git a/test/incremental/move_src b/test/incremental/move_src index 4f43e8ea6a..d6a21fc562 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.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print("{d} {d}\n", .{ foo(), bar() }); } fn foo() u32 { @@ -22,7 +22,7 @@ fn bar() u32 { #file=main.zig const std = @import("std"); pub fn main() !void { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print("{d} {d}\n", .{ foo(), bar() }); } diff --git a/test/incremental/no_change_preserves_tag_names b/test/incremental/no_change_preserves_tag_names index 623496119d..e399e083e1 100644 --- a/test/incremental/no_change_preserves_tag_names +++ b/test/incremental/no_change_preserves_tag_names @@ -8,7 +8,7 @@ const std = @import("std"); var some_enum: enum { first, second } = .first; pub fn main() !void { - try std.fs.File.stdout().writeAll(@tagName(some_enum)); + try std.Io.File.stdout().writeAll(@tagName(some_enum)); } #expect_stdout="first" #update=no change @@ -16,6 +16,6 @@ pub fn main() !void { const std = @import("std"); var some_enum: enum { first, second } = .first; pub fn main() !void { - try std.fs.File.stdout().writeAll(@tagName(some_enum)); + try std.Io.File.stdout().writeAll(@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 a5a03749b8..20e43b64b7 100644 --- a/test/incremental/recursive_function_becomes_non_recursive +++ b/test/incremental/recursive_function_becomes_non_recursive @@ -9,7 +9,7 @@ pub fn main() !void { try foo(false); } fn foo(recurse: bool) !void { - const stdout = std.fs.File.stdout(); + const stdout = std.Io.File.stdout(); if (recurse) return foo(true); try stdout.writeAll("non-recursive path\n"); } @@ -22,7 +22,7 @@ pub fn main() !void { try foo(true); } fn foo(recurse: bool) !void { - const stdout = std.fs.File.stdout(); + const stdout = std.Io.File.stdout(); if (recurse) return stdout.writeAll("x==1\n"); try stdout.writeAll("non-recursive path\n"); } diff --git a/test/incremental/remove_enum_field b/test/incremental/remove_enum_field index 02daf2a0fb..bbcf7718e9 100644 --- a/test/incremental/remove_enum_field +++ b/test/incremental/remove_enum_field @@ -10,7 +10,7 @@ const MyEnum = enum(u8) { bar = 2, }; pub fn main() !void { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print("{}\n", .{@intFromEnum(MyEnum.foo)}); } const std = @import("std"); @@ -22,7 +22,7 @@ const MyEnum = enum(u8) { bar = 2, }; pub fn main() !void { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); try stdout_writer.interface.print("{}\n", .{@intFromEnum(MyEnum.foo)}); } const std = @import("std"); diff --git a/test/incremental/unreferenced_error b/test/incremental/unreferenced_error index 505fb3d5f4..1c1f1f7a8f 100644 --- a/test/incremental/unreferenced_error +++ b/test/incremental/unreferenced_error @@ -7,7 +7,7 @@ #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll(a); + try std.Io.File.stdout().writeAll(a); } const a = "Hello, World!\n"; #expect_stdout="Hello, World!\n" @@ -16,7 +16,7 @@ const a = "Hello, World!\n"; #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll(a); + try std.Io.File.stdout().writeAll(a); } const a = @compileError("bad a"); #expect_error=main.zig:5:11: error: bad a @@ -25,7 +25,7 @@ const a = @compileError("bad a"); #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll(b); + try std.Io.File.stdout().writeAll(b); } const a = @compileError("bad a"); const b = "Hi there!\n"; @@ -35,7 +35,7 @@ const b = "Hi there!\n"; #file=main.zig const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll(a); + try std.Io.File.stdout().writeAll(a); } const a = "Back to a\n"; const b = @compileError("bad b"); diff --git a/test/link/bss/main.zig b/test/link/bss/main.zig index 2785a8360f..9c104fec04 100644 --- a/test/link/bss/main.zig +++ b/test/link/bss/main.zig @@ -4,7 +4,7 @@ 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(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); buffer[0x10] = 1; diff --git a/test/link/elf.zig b/test/link/elf.zig index 824fc76e92..6d9912193b 100644 --- a/test/link/elf.zig +++ b/test/link/elf.zig @@ -1323,7 +1323,7 @@ fn testGcSectionsZig(b: *Build, opts: Options) *Step { \\extern var live_var2: i32; \\extern fn live_fn2() void; \\pub fn main() void { - \\ var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + \\ var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); \\ stdout_writer.interface.print("{d} {d}\n", .{ live_var1, live_var2 }) catch @panic("fail"); \\ live_fn2(); \\} @@ -1365,7 +1365,7 @@ fn testGcSectionsZig(b: *Build, opts: Options) *Step { \\extern var live_var2: i32; \\extern fn live_fn2() void; \\pub fn main() void { - \\ var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + \\ var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); \\ stdout_writer.interface.print("{d} {d}\n", .{ live_var1, live_var2 }) catch @panic("fail"); \\ live_fn2(); \\} diff --git a/test/link/macho.zig b/test/link/macho.zig index 4fc0cad0ee..0f3df8c2d8 100644 --- a/test/link/macho.zig +++ b/test/link/macho.zig @@ -716,7 +716,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.fs.File.stdout().writeAll("Hello world!\n") catch @panic("fail"); + \\ std.Io.File.stdout().writeAll("Hello world!\n") catch @panic("fail"); \\} }); @@ -2371,7 +2371,7 @@ fn testTlsZig(b: *Build, opts: Options) *Step { \\threadlocal var x: i32 = 0; \\threadlocal var y: i32 = -1; \\pub fn main() void { - \\ var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + \\ var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); \\ stdout_writer.interface.print("{d} {d}\n", .{x, y}) catch unreachable; \\ x -= 1; \\ y += 1; diff --git a/test/link/wasm/extern/main.zig b/test/link/wasm/extern/main.zig index 9635f64a40..a841cc40a6 100644 --- a/test/link/wasm/extern/main.zig +++ b/test/link/wasm/extern/main.zig @@ -3,6 +3,6 @@ const std = @import("std"); extern const foo: u32; pub fn main() void { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); stdout_writer.interface.print("Result: {d}", .{foo}) catch {}; } diff --git a/test/src/Cases.zig b/test/src/Cases.zig index b1fece44d9..5889449bbe 100644 --- a/test/src/Cases.zig +++ b/test/src/Cases.zig @@ -1,6 +1,8 @@ const Cases = @This(); const builtin = @import("builtin"); + const std = @import("std"); +const Io = std.Io; const assert = std.debug.assert; const Allocator = std.mem.Allocator; const getExternalExecutor = std.zig.system.getExternalExecutor; @@ -313,7 +315,7 @@ pub fn addCompile( /// Each file should include a test manifest as a contiguous block of comments at /// the end of the file. The first line should be the test type, followed by a set of /// key-value config values, followed by a blank line, then the expected output. -pub fn addFromDir(ctx: *Cases, dir: std.fs.Dir, b: *std.Build) void { +pub fn addFromDir(ctx: *Cases, dir: Io.Dir, b: *std.Build) void { var current_file: []const u8 = "none"; ctx.addFromDirInner(dir, ¤t_file, b) catch |err| { std.debug.panicExtra( @@ -326,7 +328,7 @@ pub fn addFromDir(ctx: *Cases, dir: std.fs.Dir, b: *std.Build) void { fn addFromDirInner( ctx: *Cases, - iterable_dir: std.fs.Dir, + iterable_dir: Io.Dir, /// This is kept up to date with the currently being processed file so /// that if any errors occur the caller knows it happened during this file. current_file: *[]const u8, diff --git a/test/src/convert-stack-trace.zig b/test/src/convert-stack-trace.zig index 91be53a8e5..8d04500fba 100644 --- a/test/src/convert-stack-trace.zig +++ b/test/src/convert-stack-trace.zig @@ -44,7 +44,7 @@ pub fn main() !void { const in_file = try std.fs.cwd().openFile(args[1], .{}); defer in_file.close(); - const out_file: std.fs.File = .stdout(); + const out_file: std.Io.File = .stdout(); var in_fr = in_file.reader(io, &read_buf); var out_fw = out_file.writer(&write_buf); diff --git a/test/standalone/child_process/child.zig b/test/standalone/child_process/child.zig index 2e74f30882..5dbf95af4c 100644 --- a/test/standalone/child_process/child.zig +++ b/test/standalone/child_process/child.zig @@ -33,12 +33,12 @@ fn run(allocator: std.mem.Allocator, io: Io) !void { } // test stdout pipe; parent verifies - try std.fs.File.stdout().writeAll("hello from stdout"); + try std.Io.File.stdout().writeAll("hello from stdout"); // test stdin pipe from parent const hello_stdin = "hello from stdin"; var buf: [hello_stdin.len]u8 = undefined; - const stdin: std.fs.File = .stdin(); + const stdin: std.Io.File = .stdin(); var reader = stdin.reader(io, &.{}); const n = try reader.interface.readSliceShort(&buf); if (!std.mem.eql(u8, buf[0..n], hello_stdin)) { @@ -47,7 +47,7 @@ fn run(allocator: std.mem.Allocator, io: Io) !void { } fn testError(comptime fmt: []const u8, args: anytype) void { - var stderr_writer = std.fs.File.stderr().writer(&.{}); + var stderr_writer = std.Io.File.stderr().writer(&.{}); const stderr = &stderr_writer.interface; stderr.print("CHILD TEST ERROR: ", .{}) catch {}; stderr.print(fmt, args) catch {}; diff --git a/test/standalone/child_process/main.zig b/test/standalone/child_process/main.zig index 5970cdd952..b20a7fed49 100644 --- a/test/standalone/child_process/main.zig +++ b/test/standalone/child_process/main.zig @@ -62,7 +62,7 @@ pub fn main() !void { var parent_test_error = false; fn testError(comptime fmt: []const u8, args: anytype) void { - var stderr_writer = std.fs.File.stderr().writer(&.{}); + var stderr_writer = std.Io.File.stderr().writer(&.{}); const stderr = &stderr_writer.interface; stderr.print("PARENT TEST ERROR: ", .{}) catch {}; stderr.print(fmt, args) catch {}; diff --git a/test/standalone/simple/cat/main.zig b/test/standalone/simple/cat/main.zig index 9ea980aecc..dea528f4f7 100644 --- a/test/standalone/simple/cat/main.zig +++ b/test/standalone/simple/cat/main.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const fs = std.fs; +const Io = std.Io; const mem = std.mem; const warn = std.log.warn; const fatal = std.process.fatal; @@ -18,11 +18,11 @@ pub fn main() !void { const exe = args[0]; var catted_anything = false; var stdout_buffer: [4096]u8 = undefined; - var stdout_writer = fs.File.stdout().writerStreaming(&stdout_buffer); + var stdout_writer = Io.File.stdout().writerStreaming(&stdout_buffer); const stdout = &stdout_writer.interface; - var stdin_reader = fs.File.stdin().readerStreaming(io, &.{}); + var stdin_reader = Io.File.stdin().readerStreaming(io, &.{}); - const cwd = fs.cwd(); + const cwd = Io.Dir.cwd(); for (args[1..]) |arg| { if (mem.eql(u8, arg, "-")) { diff --git a/test/standalone/simple/guess_number/main.zig b/test/standalone/simple/guess_number/main.zig index d477de2b78..25226ec1c8 100644 --- a/test/standalone/simple/guess_number/main.zig +++ b/test/standalone/simple/guess_number/main.zig @@ -2,9 +2,9 @@ const builtin = @import("builtin"); const std = @import("std"); pub fn main() !void { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); const out = &stdout_writer.interface; - const stdin: std.fs.File = .stdin(); + const stdin: std.Io.File = .stdin(); try out.writeAll("Welcome to the Guess Number Game in Zig.\n"); diff --git a/test/standalone/simple/hello_world/hello.zig b/test/standalone/simple/hello_world/hello.zig index 3b2b910687..37c5c4bb1b 100644 --- a/test/standalone/simple/hello_world/hello.zig +++ b/test/standalone/simple/hello_world/hello.zig @@ -1,5 +1,5 @@ const std = @import("std"); pub fn main() !void { - try std.fs.File.stdout().writeAll("Hello, World!\n"); + try std.Io.File.stdout().writeAll("Hello, World!\n"); } diff --git a/test/standalone/windows_bat_args/echo-args.zig b/test/standalone/windows_bat_args/echo-args.zig index 054c4a6975..7e73fa54a0 100644 --- a/test/standalone/windows_bat_args/echo-args.zig +++ b/test/standalone/windows_bat_args/echo-args.zig @@ -5,7 +5,7 @@ pub fn main() !void { defer arena_state.deinit(); const arena = arena_state.allocator(); - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); const stdout = &stdout_writer.interface; var args = try std.process.argsAlloc(arena); for (args[1..], 1..) |arg, i| { diff --git a/test/standalone/windows_paths/relative.zig b/test/standalone/windows_paths/relative.zig index 8301549667..7f87151ac8 100644 --- a/test/standalone/windows_paths/relative.zig +++ b/test/standalone/windows_paths/relative.zig @@ -13,7 +13,7 @@ pub fn main() !void { const relative = try std.fs.path.relative(allocator, args[1], args[2]); defer allocator.free(relative); - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); const stdout = &stdout_writer.interface; try stdout.writeAll(relative); } diff --git a/test/standalone/windows_spawn/hello.zig b/test/standalone/windows_spawn/hello.zig index fb4a827e23..e54bbe0386 100644 --- a/test/standalone/windows_spawn/hello.zig +++ b/test/standalone/windows_spawn/hello.zig @@ -1,7 +1,7 @@ const std = @import("std"); pub fn main() !void { - var stdout_writer = std.fs.File.stdout().writerStreaming(&.{}); + var stdout_writer = std.Io.File.stdout().writerStreaming(&.{}); const stdout = &stdout_writer.interface; try stdout.writeAll("hello from exe\n"); } diff --git a/test/standalone/windows_spawn/main.zig b/test/standalone/windows_spawn/main.zig index 10ee35f4df..f388070097 100644 --- a/test/standalone/windows_spawn/main.zig +++ b/test/standalone/windows_spawn/main.zig @@ -1,4 +1,5 @@ const std = @import("std"); +const Io = std.Io; const windows = std.os.windows; const utf16Literal = std.unicode.utf8ToUtf16LeStringLiteral; @@ -218,7 +219,7 @@ fn testExecWithCwd(allocator: std.mem.Allocator, command: []const u8, cwd: ?[]co try std.testing.expectEqualStrings(expected_stdout, result.stdout); } -fn renameExe(dir: std.fs.Dir, old_sub_path: []const u8, new_sub_path: []const u8) !void { +fn renameExe(dir: Io.Dir, old_sub_path: []const u8, new_sub_path: []const u8) !void { var attempt: u5 = 0; while (true) break dir.rename(old_sub_path, new_sub_path) catch |err| switch (err) { error.AccessDenied => { diff --git a/test/tests.zig b/test/tests.zig index 0911ae2e46..2b0e8fb5d0 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -2629,10 +2629,11 @@ pub fn addCases( ) !void { const arena = b.allocator; const gpa = b.allocator; + const io = b.graph.io; var cases = @import("src/Cases.zig").init(gpa, arena); - var dir = try b.build_root.handle.openDir("test/cases", .{ .iterate = true }); + var dir = try b.build_root.handle.openDir(io, "test/cases", .{ .iterate = true }); defer dir.close(); cases.addFromDir(dir, b); |
