http://qs321.pair.com?node_id=11119755


in reply to Re^5: Inverting test conditions in Test::More ?
in thread Inverting test conditions in Test::More ?

The test data is generated, finding the difference manually isn't easy.

Furthermore, the idea of having Boolean logic for tests is straightforward and makes the code elegant and readable.

Most importantly it's generic, I can't tell which other test besides is_deeply doesn't provide a negation.

And I learned a lot about the test suite, especially Test::Builder in the course of this thread, just by asking this "silly question".

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

  • Comment on Re^6: Inverting test conditions in Test::More ?

Replies are listed 'Best First'.
Re^7: Inverting test conditions in Test::More ?
by hippo (Bishop) on Jul 24, 2020 at 14:09 UTC
    I can't tell which other test besides is_deeply doesn't provide a negation.

    From Test::More I would offer:

    • use_ok
    • require_ok
    • isa_ok
    • can_ok

    none of which have a negative. Technically ok doesn't have a negative either but the trivial workaround of negating the argument should be sufficient for that one.


    🦛

      > none of which have a negative.

      Thanks! :)

      > From Test::More I would offer:

      May I add, from Test::More alone!

      There are so many more Test:: modules out there probably not as well designed as Test::More.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery