in reply to Inverting test conditions in Test::More ?
There doesn't seem to be a simple, generic way to negate an arbitrary test in Test::More AFAICT. But, if you are happy enough to dip your toe in the Test2::Suite waters:
use strict; use warnings; use Test2::V0; use Test2::Tools::Compare qw/is isnt/; my $w = { z => [ 0 .. 5 ] }; my $x = { z => [ 0 .. 5 ] }; my $y = { z => [ 1 .. 5 ] }; is ($w, $x, 'Match is good'); isnt ($x, $y, 'Not matching - also good'); done_testing;
🦛
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Inverting test conditions in Test::More ? (workaround)
by LanX (Saint) on Jul 24, 2020 at 11:06 UTC | |
by Arunbear (Prior) on Jul 24, 2020 at 13:43 UTC | |
by LanX (Saint) on Jul 24, 2020 at 13:54 UTC | |
by LanX (Saint) on Jul 24, 2020 at 14:43 UTC |
In Section
Seekers of Perl Wisdom