Skip to content

test: fix _check_for_croak() to validate error messages#88

Merged
atoomic merged 1 commit into
cpan-authors:mainfrom
atoomic:koan.atoomic/fix-check-for-croak
Mar 13, 2026
Merged

test: fix _check_for_croak() to validate error messages#88
atoomic merged 1 commit into
cpan-authors:mainfrom
atoomic:koan.atoomic/fix-check-for-croak

Conversation

@Koan-Bot
Copy link
Copy Markdown
Contributor

@Koan-Bot Koan-Bot commented Mar 13, 2026

What

Replace ok($@, "/$expected/") with like($@, qr/$expected/) in _check_for_croak().

Why

The old helper only checked that $@ was truthy — the string "/$expected/" was the test description, not a regex match. Any croak would pass regardless of the actual error message. This means a renamed or wrong error message would go undetected.

How

One-line change: ok()like() with a compiled qr// pattern and a descriptive test name.

Testing

All 281 tests pass. Verified the 4 expected strings (Public keys cannot decrypt/be checked/private_encrypt/sign messages) match the croak calls in RSA.xs.

🤖 Generated with Claude Code


Quality Report

Changes: 1 file changed, 1 insertion(+), 1 deletion(-)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

The helper used ok($@, "/$expected/") which only checked that $@
was truthy — the second argument was just the test description,
not a regex match. Replace with like($@, qr/$expected/) to actually
validate that croak produces the expected error message.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@atoomic atoomic marked this pull request as ready for review March 13, 2026 05:01
@atoomic atoomic merged commit 7b04faa into cpan-authors:main Mar 13, 2026
61 checks passed
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