Skip to content

PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust

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

aiongg6b3aade2eb15
diff --git a/crates/ui-egui/src/editing.rs b/crates/ui-egui/src/editing.rs
index be1347d68..799b5f150 100644
--- a/crates/ui-egui/src/editing.rs
+++ b/crates/ui-egui/src/editing.rs
@@ -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)]