Skip to content

test: fix always-true ok(defined $@) assertion in padding.t#94

Merged
atoomic merged 1 commit into
cpan-authors:mainfrom
atoomic:koan.atoomic/test-padding-defined-bug
Mar 16, 2026
Merged

test: fix always-true ok(defined $@) assertion in padding.t#94
atoomic merged 1 commit into
cpan-authors:mainfrom
atoomic:koan.atoomic/test-padding-defined-bug

Conversation

@Koan-Bot
Copy link
Copy Markdown
Contributor

What

Fix ok(defined $@) assertion that always passes, and correct the test
expectation for signing with OAEP padding.

Why

$@ is always defined in Perl — it's "" on success. Using defined $@
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

  • Replace ok(defined $@, ...) with ok($@, ...) to actually test truthiness
  • Skip the "invalid signing" assertion for pkcs1_oaep since signing uses
    its own padding and doesn't croak when OAEP is set
  • Add descriptive name to bare ok(check_key()) while here

Testing

make test — 281 tests pass (7 now correctly skipped instead of falsely passing).

🤖 Generated with Claude Code

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 atoomic marked this pull request as ready for review March 15, 2026 23:01
@atoomic atoomic merged commit a2db97c into cpan-authors:main Mar 16, 2026
54 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