Skip to content

Commit 69d2749

Browse files
committed
fix(pdf-cos): fix Rust test failures
- .gitignore: unblock assets/*.pdf so fixture PDFs are committed (tests need example.pdf, encrypted.pdf, Incremental.pdf, unicode.pdf, AnnotationDemo.pdf at compile time and integration test runtime) - parser: accept bare \n in xref_eol (in addition to ' \r', ' \n', '\r\n') so that lenient/non-standard xref tables are parsed correctly; fixes big_generation_value test
1 parent 0064df6 commit 69d2749

7 files changed

Lines changed: 4 additions & 1 deletion

File tree

crates/pdf-cos/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
target
22
Cargo.lock
3+
# Generated test output PDFs (created/modified by tests)
34
test*.pdf
45
*.pdf
6+
# Allow fixture PDFs in assets/ — needed by doc-tests and integration tests
7+
!assets/*.pdf
58
.idea
69
*log.txt
710
specs
6.57 MB
Binary file not shown.
1.88 KB
Binary file not shown.
245 KB
Binary file not shown.

crates/pdf-cos/assets/example.pdf

580 Bytes
Binary file not shown.

crates/pdf-cos/assets/unicode.pdf

3.86 KB
Binary file not shown.

crates/pdf-cos/src/parser/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ pub fn binary_mark(input: ParserInput) -> Option<Vec<u8>> {
459459

460460
/// Decode CrossReferenceTable
461461
fn xref(input: ParserInput) -> NomResult<Xref> {
462-
let xref_eol = map(alt((tag(&b" \r"[..]), tag(&b" \n"[..]), tag(&b"\r\n"[..]))), |_| ());
462+
let xref_eol = map(alt((tag(&b" \r"[..]), tag(&b" \n"[..]), tag(&b"\r\n"[..]), tag(&b"\n"[..]))), |_| ());
463463
let xref_entry = pair(
464464
separated_pair(unsigned_int, tag(&b" "[..]), unsigned_int::<u32>),
465465
delimited(tag(&b" "[..]), map(one_of("nf"), |k| k == 'n'), xref_eol),

0 commit comments

Comments
 (0)