Skip to content

test: add edge case tests for Digest::base and fix b64digest arg forwarding#22

Draft
toddr-bot wants to merge 2 commits intomainfrom
koan.toddr.bot/expand-base-tests
Draft

test: add edge case tests for Digest::base and fix b64digest arg forwarding#22
toddr-bot wants to merge 2 commits intomainfrom
koan.toddr.bot/expand-base-tests

Conversation

@toddr-bot
Copy link
Copy Markdown

What

Adds comprehensive edge case test coverage for Digest::base and fixes b64digest to forward @_ to digest() consistently with hexdigest.

Why

hexdigest forwards arguments to digest(), but b64digest silently dropped them. This inconsistency means subclasses that accept optional arguments to digest() get different behavior depending on the output format.

How

  • Fix: b64digest now passes @_ through base64_padded_digest to digest (1-char change)
  • New t/base-edge.t with 15 tests covering: reset(), method chaining, auto-reset after digest, clone independence, addfile error handling, b64digest arg forwarding, padding behavior

Testing

All 15 new tests pass locally. Existing tests unaffected.

🤖 Generated with Claude Code

toddr-bot and others added 2 commits April 10, 2026 08:45
hexdigest() forwards extra arguments to digest(), but b64digest()
silently dropped them. This makes the base class methods consistent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
15 new tests covering:
- reset() state clearing via instance-method new()
- Method chaining (add returns $self)
- Chained add equivalence with multi-arg add
- Auto-reset after digest/hexdigest/b64digest
- Fresh accumulation after digest reset
- clone() independence from original
- base64_padded_digest encoding correctness
- b64digest padding stripping
- b64digest @_ forwarding (validates the base.pm fix)
- addfile() complete file reading
- addfile() error handling (croak on read failure)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant