Fergal Daly <[EMAIL PROTECTED]> writes:
> The point about modification is that if 2 things start out equal to
> one another and they are modified in the same way then they should
> still be equal to one-another.
That implies that two array refs are not equal:
use Test::More 'no_plan';
$x = [];
$y = [];
is_deeply($x, $y); # Equal, but "should" not be:
$x .= ""; # after the "same" modification
$y .= ""; # of the two things, they are
is_deeply($x, $y); # not equal!
__END__
ok 1
not ok 2
# Failed test (- at line 7)
# got: 'ARRAY(0x812b468)'
# expected: 'ARRAY(0x812b54c)'
1..2
# Looks like you failed 1 tests of 2.
Currently, is_deeply's idea of equivalence does not include that the
equivalent structures are equivalent after the same modification. Or
even that they can be modified the same way:
use Test::More 'no_plan';
$x = \do{ my $t = 1 };
$y = \1;
is_deeply($$x, $$y); # Equal, but "should" not be:
eval { $$x++ }; # after the "same" modification
eval { $$y++ }; # of the two things, they are
is_deeply($$x, $$y); # not equal!
__END__
ok 1
not ok 2
# Failed test (- at line 7)
# got: '2'
# expected: '1'
1..2
# Looks like you failed 1 tests of 2.
Note the similarity between the previous and this:
use Test::More 'no_plan';
$t = 1;
is_deeply($t, 1); # Equal, but "should" not be:
eval q{ $t++ }; # after the "same" modification
eval q{ 1++ }; # of the two things, they are
is_deeply($t, 1); # not equal!
__END__
ok 1
not ok 2
# Failed test (- at line 6)
# got: '2'
# expected: '1'
1..2
# Looks like you failed 1 tests of 2.
... and what do you know, I would welcome is_deeply to continue
behaving like this. :-)
Eirik
--
You just paddle around there awhile, and I'll explain about these poles ...
-- Sally Brown
Is that in Europe?
-- Joyce Brown