Skip to content

Cover under-tested parser helper branches#19

Merged
pgundlach merged 1 commit into
mainfrom
claude/cover-parser-helpers
Jun 23, 2026
Merged

Cover under-tested parser helper branches#19
pgundlach merged 1 commit into
mainfrom
claude/cover-parser-helpers

Conversation

@fank

@fank fank commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Backfill test coverage on logic-bearing, untrusted-input helper paths that were
below coverage. Characterization tests only — no production code changed.

Covered

  • xref.skipEOL — CR/LF/CRLF/leading-space line-ending rules (§7.5.4)
  • filter.paramsFromDict — predictor knobs + /EarlyChange semantics
  • reader.streamLength — missing / non-integer / negative /Length guards
  • contentstream.readValue — every value kind + EOF/delimiter/unexpected-keyword errors
  • internal/filter paeth/abs (hand-computed PNG §6.6 vectors) + ErrUnsupported message
  • crypt.computeV5Key — owner-password path + >127-byte password truncation
  • internal/lex position accessors

Each targeted function went from <70% (several at 0%) to 90–100%; overall 81.2% → 83.1%. go vet and gofmt clean.

Deliberately left uncovered

  • LZW early-change=1 boundary crossing — needs a real qpdf/Ghostscript fixture for an independent oracle, not a fabricated one.
  • examples/ and cmd main() entry points, and no-logic getters (Stream.RawLength, interface marker methods) — testing them asserts nothing about correctness.

Backfill characterization tests for logic-bearing untrusted-input paths
that were below coverage; no production code changed.

- xref skipEOL: CR/LF/CRLF/leading-space line-ending rules
- filter paramsFromDict: predictor knobs + /EarlyChange semantics
- reader streamLength: missing/non-integer/negative /Length guards
- contentstream readValue: every value kind + EOF/delimiter/keyword errors
- internal/filter paeth/abs + ErrUnsupported message
- crypt computeV5Key: owner-password path + >127 truncation
- lex position accessors
@fank fank marked this pull request as ready for review June 23, 2026 09:10
@fank fank requested a review from pgundlach June 23, 2026 09:10
@pgundlach pgundlach merged commit fd74315 into main Jun 23, 2026
1 check passed
@pgundlach pgundlach deleted the claude/cover-parser-helpers branch June 23, 2026 09:15
@pgundlach

Copy link
Copy Markdown
Member

If you want me to comment only and not merge them directly after a review, please tell me.

I take a look at your pull requests, find them good (perfect) and then I don't see a point in having an extra loop. Stop me if you want.

@fank

fank commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator Author

@pgundlach I let you know if there something that rises questions, at the moment I am just trying to increase coverage.
Since this ist mostly done by an automated harness, it is helpful to review it just in case.
The reason why there are smaller instead of a large PR to keep the context small for easy review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants