mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-08 12:02:28 +00:00
M4: use fixed-size slices in named destination regressions
This commit is contained in:
1 parent
cc22faca2f
commit
3326882463
2 files changed
+2
-2
No files matched your search
@@ -824,7 +824,7 @@ fn assert_destination_state(a: &Automation, doc: u64, depth: usize, count: usize
|
||||
let pairs = node.as_dict().unwrap().get(b"Names").and_then(Object::as_array).unwrap();
|
||||
assert_eq!(pairs.len(), if deleted { count / 2 * 2 } else { count * 2 });
|
||||
let expected = (0..count).filter(|i| !deleted || i % 2 == 1);
|
||||
for (pair, i) in pairs.chunks_exact(2).zip(expected) {
|
||||
for (pair, i) in pairs.as_chunks::<2>().0.iter().zip(expected) {
|
||||
assert_eq!(pair[0].as_string().unwrap().to_text(), format!("dest-{i:05}"));
|
||||
let target = if i % 2 == 0 { pages[0].obj } else { pages.last().unwrap().obj };
|
||||
assert_eq!(pair[1].as_array().unwrap()[0].as_ref(), Some(target), "destination {i}");
|
||||
|
||||
@@ -308,7 +308,7 @@ fn deleting_a_page_keeps_sixty_thousand_named_destinations_usable() {
|
||||
let pairs = leaf.get(b"Names").unwrap().as_array().unwrap();
|
||||
assert_eq!(pairs.len(), 60_000, "30,000 surviving name/value pairs");
|
||||
let page = pages(&reopened).unwrap()[1].obj;
|
||||
for (pair, i) in pairs.chunks_exact(2).zip((1..60_000).step_by(2)) {
|
||||
for (pair, i) in pairs.as_chunks::<2>().0.iter().zip((1..60_000).step_by(2)) {
|
||||
assert_eq!(pair[0].as_string().unwrap().to_text(), format!("dest-{i:05}"));
|
||||
assert_eq!(pair[1].as_array().unwrap()[0].as_ref(), Some(page));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user