Skip to content

test: expand Digest::base edge case coverage + fix b64digest @_ forwarding#9

Draft
toddr-bot wants to merge 22 commits into
gisle:masterfrom
Dual-Life:koan.toddr.bot/expand-base-tests
Draft

test: expand Digest::base edge case coverage + fix b64digest @_ forwarding#9
toddr-bot wants to merge 22 commits into
gisle:masterfrom
Dual-Life:koan.toddr.bot/expand-base-tests

Conversation

@toddr-bot
Copy link
Copy Markdown

What

Adds 15 edge case tests for Digest::base and fixes a minor inconsistency in b64digest().

Why

The base class has only 13 tests, none covering reset(), clone() independence, auto-reset behavior after digest operations, or addfile() error handling. These gaps mean regressions in the base class contract could go undetected.

The b64digest fix: hexdigest() and base64_padded_digest() both forward @_ to digest(), but b64digest() silently dropped extra arguments. A one-line fix for consistency.

How

  • Commit 1: Fix b64digest to forward @_ through base64_padded_digest (one line)
  • Commit 2: New t/base-edge.t with mock digest classes that properly implement the instance-method new() contract (as documented in the Digest POD)

Tests cover: reset(), method chaining, chained vs multi-arg add() equivalence, auto-reset after digest/hexdigest/b64digest, clone() independence, base64 padding correctness, @_ forwarding, addfile() content and error paths.

Testing

All 38 tests pass (23 existing + 15 new). Tested locally.

🤖 Generated with Claude Code

toddr and others added 22 commits October 6, 2020 09:56
- meta-spec 2 resources format
- dependencies are static, set dynamic_config 0
- EUMM will set configure_requires on itself
- Test::More only used in tests
- boilerplate to clean out unsupported keys if installed with old EUMM
Makefile.PL - use meta-spec 2, fix prereqs, compatibility with old EUMM
base.t, file.t: unlink temporary files created during testing
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.

5 participants