mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
test: fix "chdir smoke test" comparing paths with potentially different drive letter cases
This commit is contained in:
parent
0a8b7ad368
commit
bb4cb34204
@ -64,7 +64,14 @@ test "chdir smoke test" {
|
||||
|
||||
var new_cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
|
||||
const new_cwd = try os.getcwd(new_cwd_buf[0..]);
|
||||
try expect(mem.eql(u8, tmp_dir_path, new_cwd));
|
||||
|
||||
// On Windows, fs.path.resolve returns an uppercase drive letter, but the drive letter returned by getcwd may be lowercase
|
||||
var resolved_cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined;
|
||||
var resolved_cwd = path: {
|
||||
var allocator = std.heap.FixedBufferAllocator.init(&resolved_cwd_buf);
|
||||
break :path try fs.path.resolve(allocator.allocator(), &[_][]const u8{new_cwd});
|
||||
};
|
||||
try expect(mem.eql(u8, tmp_dir_path, resolved_cwd));
|
||||
|
||||
// Restore cwd because process may have other tests that do not tolerate chdir.
|
||||
tmp_dir.close();
|
||||
|
Loading…
Reference in New Issue
Block a user