| ... | @@ -539,5 +539,16 @@ test "pipeToFileSystem" { | ... | @@ -539,5 +539,16 @@ test "pipeToFileSystem" { |
| 539 | try testing.expect((try root.dir.statFile("b/symlink")).kind == .file); // statFile follows symlink | 539 | try testing.expect((try root.dir.statFile("b/symlink")).kind == .file); // statFile follows symlink |
| 540 | | 540 | |
| 541 | var buf: [32]u8 = undefined; | 541 | var buf: [32]u8 = undefined; |
| 542 | try testing.expectEqualSlices(u8, "../a/file", try root.dir.readLink("b/symlink", &buf)); | 542 | try testing.expectEqualSlices( |
| | 543 | u8, |
| | 544 | "../a/file", |
| | 545 | normalizePath(try root.dir.readLink("b/symlink", &buf)), |
| | 546 | ); |
| | 547 | } |
| | 548 | |
| | 549 | fn normalizePath(bytes: []u8) []u8 { |
| | 550 | const canonical_sep = std.fs.path.sep_posix; |
| | 551 | if (std.fs.path.sep == canonical_sep) return bytes; |
| | 552 | std.mem.replaceScalar(u8, bytes, std.fs.path.sep, canonical_sep); |
| | 553 | return bytes; |
| 543 | } | 554 | } |