zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 78019452f7caf5badc1fac2fe11fbac19449792f (tree)
parent 1bc0df72504b6839815dd132e513ee582bdf5399
Author: Ryan Liptak <squeek502@hotmail.com>
Date:   Sun, 23 May 2021 16:35:31 -0700

Add updateFile to . and .. fs tests

Diffstat:
Mlib/std/fs/test.zig | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/lib/std/fs/test.zig b/lib/std/fs/test.zig @@ -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); }