| ... | ... | @@ -101,6 +101,27 @@ test "openDir cwd parent .." { |
| 101 | 101 | defer dir.close(); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | test "openDir non-cwd parent .." { |
| 105 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 106 | |
| 107 | var tmp = tmpDir(.{}); |
| 108 | defer tmp.cleanup(); |
| 109 | |
| 110 | var subdir = try tmp.dir.makeOpenPath("subdir", .{}); |
| 111 | defer subdir.close(); |
| 112 | |
| 113 | var dir = try subdir.openDir("..", .{}); |
| 114 | defer dir.close(); |
| 115 | |
| 116 | const expected_path = try tmp.dir.realpathAlloc(testing.allocator, "."); |
| 117 | defer testing.allocator.free(expected_path); |
| 118 | |
| 119 | const actual_path = try dir.realpathAlloc(testing.allocator, "."); |
| 120 | defer testing.allocator.free(actual_path); |
| 121 | |
| 122 | try testing.expectEqualStrings(expected_path, actual_path); |
| 123 | } |
| 124 | |
| 104 | 125 | test "readLinkAbsolute" { |
| 105 | 126 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 106 | 127 | |