| ... | @@ -160,6 +160,23 @@ fn testReadLink(dir: Dir, target_path: []const u8, symlink_path: []const u8) !vo | ... | @@ -160,6 +160,23 @@ fn testReadLink(dir: Dir, target_path: []const u8, symlink_path: []const u8) !vo |
| 160 | try testing.expectEqualStrings(target_path, given); | 160 | try testing.expectEqualStrings(target_path, given); |
| 161 | } | 161 | } |
| 162 | | 162 | |
| | 163 | test "relative symlink to parent directory" { |
| | 164 | var tmp = tmpDir(.{}); |
| | 165 | defer tmp.cleanup(); |
| | 166 | |
| | 167 | var subdir = try tmp.dir.makeOpenPath("subdir", .{}); |
| | 168 | defer subdir.close(); |
| | 169 | |
| | 170 | const expected_link_name = ".." ++ std.fs.path.sep_str ++ "b.txt"; |
| | 171 | |
| | 172 | try subdir.symLink(expected_link_name, "a.txt", .{}); |
| | 173 | |
| | 174 | var buf: [1000]u8 = undefined; |
| | 175 | const link_name = try subdir.readLink("a.txt", &buf); |
| | 176 | |
| | 177 | try testing.expectEqualStrings(expected_link_name, link_name); |
| | 178 | } |
| | 179 | |
| 163 | test "openDir" { | 180 | test "openDir" { |
| 164 | try testWithAllSupportedPathTypes(struct { | 181 | try testWithAllSupportedPathTypes(struct { |
| 165 | fn impl(ctx: *TestContext) !void { | 182 | fn impl(ctx: *TestContext) !void { |