test: fix _check_for_croak() to validate error messages#88
Merged
atoomic merged 1 commit intoMar 13, 2026
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Replace
ok($@, "/$expected/")withlike($@, 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 compiledqr//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