authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2025-12-26 17:12:50-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-26 19:58:56-08:00
log447f80c0cc66f9f214e54f8808372d9fe3e105d1
tree1e9762eb71a88b9e330a4fc2e7c645502e2f71f7
parent252c4e57c68d8ed0c2eecc17dfa5f6c63e672df2

Delete test_symlink in standalone/posix, it's fully redundant

See readlink tests in std/fs/test.zig

1 files changed, 0 insertions(+), 29 deletions(-)

test/standalone/posix/relpaths.zig-29
......@@ -5,7 +5,6 @@ const builtin = @import("builtin");
55
66const std = @import("std");
77const Io = std.Io;
8const Allocator = std.mem.Allocator;
98
109pub fn main() !void {
1110 if (builtin.target.os.tag == .wasi) return; // Can link, but can't change into tmpDir
......@@ -24,37 +23,9 @@ pub fn main() !void {
2423 // Want to test relative paths, so cd into the tmpdir for these tests
2524 try std.process.setCurrentDir(io, tmp.dir);
2625
27 try test_symlink(gpa, io, tmp);
2826 try test_link(io, tmp);
2927}
3028
31fn test_symlink(gpa: Allocator, io: Io, tmp: TmpDir) !void {
32 const target_name = "symlink-target";
33 const symlink_name = "symlinker";
34
35 // Create the target file
36 try tmp.dir.writeFile(io, .{ .sub_path = target_name, .data = "nonsense" });
37
38 if (builtin.target.os.tag == .windows) {
39 const wtarget_name = try std.unicode.wtf8ToWtf16LeAllocZ(gpa, target_name);
40 const wsymlink_name = try std.unicode.wtf8ToWtf16LeAllocZ(gpa, symlink_name);
41 defer gpa.free(wtarget_name);
42 defer gpa.free(wsymlink_name);
43
44 std.os.windows.CreateSymbolicLink(tmp.dir.fd, wsymlink_name, wtarget_name, false) catch |err| switch (err) {
45 // Symlink requires admin privileges on windows, so this test can legitimately fail.
46 error.AccessDenied => return,
47 else => return err,
48 };
49 } else {
50 try Io.Dir.cwd().symLink(io, target_name, symlink_name, .{});
51 }
52
53 var buffer: [std.fs.max_path_bytes]u8 = undefined;
54 const given = buffer[0..try Io.Dir.cwd().readLink(io, symlink_name, &buffer)];
55 try std.testing.expectEqualStrings(target_name, given);
56}
57
5829fn test_link(io: Io, tmp: TmpDir) !void {
5930 switch (builtin.target.os.tag) {
6031 .linux, .illumos => {},