| ... | @@ -64,7 +64,14 @@ test "chdir smoke test" { | ... | @@ -64,7 +64,14 @@ test "chdir smoke test" { |
| 64 | | 64 | |
| 65 | var new_cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined; | 65 | var new_cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined; |
| 66 | const new_cwd = try os.getcwd(new_cwd_buf[0..]); | 66 | const new_cwd = try os.getcwd(new_cwd_buf[0..]); |
| 67 | try expect(mem.eql(u8, tmp_dir_path, new_cwd)); | 67 | |
| | 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)); |
| 68 | | 75 | |
| 69 | // Restore cwd because process may have other tests that do not tolerate chdir. | 76 | // Restore cwd because process may have other tests that do not tolerate chdir. |
| 70 | tmp_dir.close(); | 77 | tmp_dir.close(); |