authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2021-05-23 16:35:31-07:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2021-05-23 16:35:31-07:00
log78019452f7caf5badc1fac2fe11fbac19449792f
treee2e70b0a691e682d0d670a7ce1ec8a42000a0e9d
parent1bc0df72504b6839815dd132e513ee582bdf5399

Add updateFile to . and .. fs tests


1 files changed, 11 insertions(+), 0 deletions(-)

lib/std/fs/test.zig+11
......@@ -954,6 +954,10 @@ test ". and .. in fs.Dir functions" {
954954 renamed_file.close();
955955 try tmp.dir.deleteFile("./subdir/../rename");
956956
957 try tmp.dir.writeFile("./subdir/../update", "something");
958 const prev_status = try tmp.dir.updateFile("./subdir/../file", tmp.dir, "./subdir/../update", .{});
959 try testing.expectEqual(fs.PrevStatus.stale, prev_status);
960
957961 try tmp.dir.deleteDir("./subdir");
958962}
959963
......@@ -991,5 +995,12 @@ test ". and .. in absolute functions" {
991995 renamed_file.close();
992996 try fs.deleteFileAbsolute(renamed_file_path);
993997
998 const update_file_path = try fs.path.join(allocator, &[_][]const u8{ subdir_path, "../update" });
999 const update_file = try fs.createFileAbsolute(update_file_path, .{});
1000 try update_file.writeAll("something");
1001 update_file.close();
1002 const prev_status = try fs.updateFileAbsolute(created_file_path, update_file_path, .{});
1003 try testing.expectEqual(fs.PrevStatus.stale, prev_status);
1004
9941005 try fs.deleteDirAbsolute(subdir_path);
9951006}