mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 14:25:16 +00:00
Add updateFile to . and .. fs tests
This commit is contained in:
parent
1bc0df7250
commit
78019452f7
@ -954,6 +954,10 @@ test ". and .. in fs.Dir functions" {
|
||||
renamed_file.close();
|
||||
try tmp.dir.deleteFile("./subdir/../rename");
|
||||
|
||||
try tmp.dir.writeFile("./subdir/../update", "something");
|
||||
const prev_status = try tmp.dir.updateFile("./subdir/../file", tmp.dir, "./subdir/../update", .{});
|
||||
try testing.expectEqual(fs.PrevStatus.stale, prev_status);
|
||||
|
||||
try tmp.dir.deleteDir("./subdir");
|
||||
}
|
||||
|
||||
@ -991,5 +995,12 @@ test ". and .. in absolute functions" {
|
||||
renamed_file.close();
|
||||
try fs.deleteFileAbsolute(renamed_file_path);
|
||||
|
||||
const update_file_path = try fs.path.join(allocator, &[_][]const u8{ subdir_path, "../update" });
|
||||
const update_file = try fs.createFileAbsolute(update_file_path, .{});
|
||||
try update_file.writeAll("something");
|
||||
update_file.close();
|
||||
const prev_status = try fs.updateFileAbsolute(created_file_path, update_file_path, .{});
|
||||
try testing.expectEqual(fs.PrevStatus.stale, prev_status);
|
||||
|
||||
try fs.deleteDirAbsolute(subdir_path);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user