We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0a8b7ad commit bb4cb34Copy full SHA for bb4cb34
1 file changed
lib/std/os/test.zig
@@ -64,7 +64,14 @@ test "chdir smoke test" {
64
65
var new_cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
66
const new_cwd = try os.getcwd(new_cwd_buf[0..]);
67
- try expect(mem.eql(u8, tmp_dir_path, new_cwd));
+
68
+ // On Windows, fs.path.resolve returns an uppercase drive letter, but the drive letter returned by getcwd may be lowercase
69
+ var resolved_cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
70
+ var resolved_cwd = path: {
71
+ var allocator = std.heap.FixedBufferAllocator.init(&resolved_cwd_buf);
72
+ break :path try fs.path.resolve(allocator.allocator(), &[_][]const u8{new_cwd});
73
+ };
74
+ try expect(mem.eql(u8, tmp_dir_path, resolved_cwd));
75
76
// Restore cwd because process may have other tests that do not tolerate chdir.
77
tmp_dir.close();
0 commit comments