mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-08 03:54:35 +00:00
cos: test that a clone's scan reaches an unread original
The clone-scan check ran after the original had already listed the object, so it passed whether or not scan findings were shared (CodeRabbit on #5816). A fresh document is now cloned before anything reads it, only the clone is scanned, and the original must list the object. Seen failing with the scan's list unshared. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
This commit is contained in:
1 parent
c013b7945e
commit
57ca07dea3
1 file changed
+4
@@ -1727,6 +1727,10 @@ fn unreadable_objects_are_listed_with_the_reason() {
|
||||
let scanned = doc.clone();
|
||||
assert_eq!(scanned.scan_objects_checked().filter(|(_, o)| o.is_err()).count(), 1);
|
||||
assert_eq!(doc.unreadable_objects(), lines, "the scan found the same object");
|
||||
let unread = Document::open(Arc::new(with_unreadable_info())).unwrap();
|
||||
let scanned = unread.clone();
|
||||
assert_eq!(scanned.scan_objects_checked().filter(|(_, o)| o.is_err()).count(), 1);
|
||||
assert_eq!(unread.unreadable_objects(), lines, "a clone's scan reaches the original");
|
||||
let mut edited = doc.clone();
|
||||
edited.set(ObjRef::new(3, 0), Object::Dict(Dict::new()));
|
||||
assert!(edited.unreadable_objects().is_empty(), "the edit replaced it");
|
||||
|
||||
Reference in new issue
Block a user