Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-Simple CPAN distribution.

Report information
The Basics
Id: 6837
Status: resolved
Priority: 0/
Queue: Test-Simple

People
Owner: Nobody in particular
Requestors: cubic [...] acronis.ru
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.47
Fixed in: (no value)



Subject: is_deeply doesn't differ 'undef' and '' when are hash values
perl -e 'use Test::More tests => 1; is_deeply([{Foo => undef}],[{Foo => ""}]);' 1..1 ok 1
From: cubic [...] acronis.ru
also perl -e 'use Test::More tests => 1; is_deeply([undef],[""]);' 1..1 ok 1 while perl -e 'use Test::More tests => 1; is_deeply(undef,"");' 1..1 not ok 1 # Failed test (-e at line 1) # got: undef # expected: '' # Looks like you failed 1 tests of 1.
Subject: [PATCH] is_deeply doesn't differ 'undef' and '' when are hash values
PATCHE from perl.qa perl #30576
--- /tmp/More.pm 2004-07-03 22:41:46.000000000 -0400 +++ /usr/share/perl/5.8.4/Test/More.pm 2004-07-03 22:44:12.000000000 -0400 @@ -1034,7 +1034,7 @@ # Quiet uninitialized value warnings when comparing undefs. local $^W = 0; - if( $e1 eq $e2 ) { + if( (defined($e1) == defined($e2)) and ($e1 eq $e2) ) { $ok = 1; } else {
Subject: [PATCH] is_deeply doesn't differ 'undef' and '' when are hash values
from perl.qa --- More.pm.orig 2004-06-30 15:15:24.182762112 +0100 +++ More.pm 2004-06-30 15:16:36.330793944 +0100 @@ -1035,7 +1035,9 @@ # Quiet uninitialized value warnings when comparing undefs. local $^W = 0; - if( ! (ref $e1 xor ref $e2) and $e1 eq $e2 ) { + if( ! (ref $e1 xor ref $e2) and + ! (defined $e1 xor defined $2) and + $e1 eq $e2 ) { $ok = 1; } else {
[guest - Mon Jul 5 06:05:46 2004]: Show quoted text
> from perl.qa > > --- More.pm.orig 2004-06-30 15:15:24.182762112 +0100 > +++ More.pm 2004-06-30 15:16:36.330793944 +0100 > @@ -1035,7 +1035,9 @@ > # Quiet uninitialized value warnings when comparing undefs. > local $^W = 0; > > - if( ! (ref $e1 xor ref $e2) and $e1 eq $e2 ) { > + if( ! (ref $e1 xor ref $e2) and > + ! (defined $e1 xor defined $2) and > + $e1 eq $e2 ) { > $ok = 1; > } > else {
There's no xor's in Test::More. Where'd that code come from?
From: cubic [...] acronis.ru
[MSCHWERN - Thu Jul 8 14:23:46 2004]: Show quoted text
> [guest - Mon Jul 5 06:05:46 2004]: >
> > from perl.qa > > > > --- More.pm.orig 2004-06-30 15:15:24.182762112 +0100 > > +++ More.pm 2004-06-30 15:16:36.330793944 +0100 > > @@ -1035,7 +1035,9 @@ > > # Quiet uninitialized value warnings when comparing undefs. > > local $^W = 0; > > > > - if( ! (ref $e1 xor ref $e2) and $e1 eq $e2 ) { > > + if( ! (ref $e1 xor ref $e2) and > > + ! (defined $e1 xor defined $2) and > > + $e1 eq $e2 ) { > > $ok = 1; > > } > > else {
> > There's no xor's in Test::More. Where'd that code come from? >
Pathch is taken from perl.qa or perl.p5p I just collect it. Didn't apply it locally.
The patch in Perlbug seems to be more accurate. See <http://rt.perl.org/rt3/Ticket/Display.html?id=30576>
In case anyone reading lacks perlbug access, below is the patch. --- /tmp/More.pm 2004-07-03 22:41:46.000000000 -0400 +++ /usr/share/perl/5.8.4/Test/More.pm 2004-07-03 22:44:12.000000000 -0400 @@ -1034,7 +1034,7 @@ # Quiet uninitialized value warnings when comparing undefs. local $^W = 0; - if( $e1 eq $e2 ) { + if( (defined($e1) == defined($e2)) and ($e1 eq $e2) ) { $ok = 1; } else {