Integration: #2699 describe the read-only refusal in the Windows staging test

This commit is contained in:
aiongg
2026-10-16 14:02:44 +00:00
parent 145896d7e8
commit 6b3aade2eb
+3 -3
View File
@@ -1226,8 +1226,8 @@ mod tests {
let _ = std::fs::remove_dir_all(&dir);
}
/// Windows refuses to replace a read-only file, so the rename fails: the staging file must not
/// be left behind.
/// A read-only target is refused before anything is staged, so no staging file is left
/// behind.
#[cfg(windows)]
#[test]
fn a_failed_save_removes_the_staging_file() {
@@ -1238,7 +1238,7 @@ mod tests {
perms.set_readonly(true);
std::fs::set_permissions(&target, perms.clone()).unwrap();
let e = write_atomically_with(&target.to_string_lossy(), b"NEW", [7]).unwrap_err();
assert_eq!(e.kind(), std::io::ErrorKind::PermissionDenied, "the rename failed: {e}");
assert_eq!(e.kind(), std::io::ErrorKind::PermissionDenied, "a read-only target is refused: {e}");
assert_eq!(read(&target), "OLD");
assert_eq!(listing(&dir), ["out.pdf"], "the staging file was removed");
#[allow(clippy::permissions_set_readonly_false)]