Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test building subroutines should have strict arity checking #88

Open
rjbs opened this issue Dec 11, 2023 · 0 comments
Open

test building subroutines should have strict arity checking #88

rjbs opened this issue Dec 11, 2023 · 0 comments

Comments

@rjbs
Copy link
Owner

rjbs commented Dec 11, 2023

I encountered this code at work, roughly:

cmp_deeply(
  $test_data,
  superhashof({ assertion-one }, { assertion-two }),
  "two assertions about data are correct",
);

This seems to the casual reader like it asserts that $test_data is a superhash of both of the given hashrefs to superhashof. Instead, arguments after the first to superhashof are silently discarded meaning that the test appears to assert more than it does. This makes the tests less valuable for no gain.

In cases like the above, Test::Deep should raise an exception.

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

No branches or pull requests

1 participant