fs tests: Add a 'non-cwd .. parent' test
This commit is contained in:
parent
3f9294c735
commit
7e542e788c
|
@ -101,6 +101,27 @@ test "openDir cwd parent .." {
|
|||
defer dir.close();
|
||||
}
|
||||
|
||||
test "openDir non-cwd parent .." {
|
||||
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
var subdir = try tmp.dir.makeOpenPath("subdir", .{});
|
||||
defer subdir.close();
|
||||
|
||||
var dir = try subdir.openDir("..", .{});
|
||||
defer dir.close();
|
||||
|
||||
const expected_path = try tmp.dir.realpathAlloc(testing.allocator, ".");
|
||||
defer testing.allocator.free(expected_path);
|
||||
|
||||
const actual_path = try dir.realpathAlloc(testing.allocator, ".");
|
||||
defer testing.allocator.free(actual_path);
|
||||
|
||||
try testing.expectEqualStrings(expected_path, actual_path);
|
||||
}
|
||||
|
||||
test "readLinkAbsolute" {
|
||||
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user