authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2023-08-11 17:48:25-07:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2023-08-11 18:58:40-07:00
log7e542e788c335b33a2c19f3ec1b453777cad901a
tree286d73d0a4563138de15c48ecafdf5fc3f5e23d3
parent3f9294c73501f55bcba1fe8b5da1ad2f2b0af9e5

fs tests: Add a 'non-cwd .. parent' test


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

lib/std/fs/test.zig+21
......@@ -101,6 +101,27 @@ test "openDir cwd parent .." {
101101 defer dir.close();
102102}
103103
104test "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
104125test "readLinkAbsolute" {
105126 if (builtin.os.tag == .wasi) return error.SkipZigTest;
106127