test: fix always-true ok(defined $@) assertion in padding.t#94
Merged
atoomic merged 1 commit intoMar 16, 2026
Merged
Conversation
ok(defined $@) always passes because $@ is always defined (empty string on success). Replace with ok($@) to actually validate that the operation croaked. Also skip the "invalid signing" test for pkcs1_oaep: OAEP only affects encryption padding, signing uses its own padding and does not croak when OAEP is set. The defined $@ bug was hiding this behavior mismatch. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
atoomic
approved these changes
Mar 16, 2026
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
Fix
ok(defined $@)assertion that always passes, and correct the testexpectation for signing with OAEP padding.
Why
$@is always defined in Perl — it's""on success. Usingdefined $@as an assertion means the test passes even when the operation succeeds,
masking real behavior: signing with pkcs1_oaep padding does not croak
(OAEP only affects encryption).
How
ok(defined $@, ...)withok($@, ...)to actually test truthinessits own padding and doesn't croak when OAEP is set
ok(check_key())while hereTesting
make test— 281 tests pass (7 now correctly skipped instead of falsely passing).🤖 Generated with Claude Code