Add updateFile to . and .. fs tests

This commit is contained in:
Ryan Liptak 2021-05-23 16:35:31 -07:00
parent 1bc0df7250
commit 78019452f7

View File

@ -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);
}