Skip to content

test building subroutines should have strict arity checking #88

@rjbs

Description

@rjbs

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions