X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Ftest.pl;h=735d96653325d2e557ceae465e134eddd8192f84;hb=3e4c85f8945e5b47709bbfe5276a94e65ba0bd48;hp=427a64f5786399a1a9f5ccb86523d0400431cf52;hpb=73421c4abe32ecb24dd956572fe602388bb7bcfc;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/test.pl b/t/test.pl index 427a64f..735d966 100644 --- a/t/test.pl +++ b/t/test.pl @@ -133,7 +133,16 @@ sub display { sub is { my ($got, $expected, $name, @mess) = @_; - my $pass = $got eq $expected; + + my $pass; + if( !defined $got || !defined $expected ) { + # undef only matches undef + $pass = !defined $got && !defined $expected; + } + else { + $pass = $got eq $expected; + } + unless ($pass) { unshift(@mess, "# got "._q($got)."\n", "# expected "._q($expected)."\n"); @@ -143,7 +152,16 @@ sub is { sub isnt { my ($got, $isnt, $name, @mess) = @_; - my $pass = $got ne $isnt; + + my $pass; + if( !defined $got || !defined $isnt ) { + # undef only matches undef + $pass = defined $got || defined $isnt; + } + else { + $pass = $got ne $isnt; + } + unless( $pass ) { unshift(@mess, "# it should not be "._q($got)."\n", "# but it is.\n");