11 use Test::Leaner::TestHelper;
14 capture_to_buffer $buf
15 or plan skip_all =>'perl 5.8 required to test is_deeply() failing';
17 plan tests => 3 * 2 * (32 + 1 + 2);
19 my $shrunk = [ [ 1, 2, 3 ] => [ 1, 2, 3 ] ];
20 delete $shrunk->[0]->[2];
21 $shrunk->[1]->[2] = undef;
26 my $code_ref = sub { };
42 [ [ undef ] => [ 0 ] ],
43 [ [ undef ] => [ '' ] ],
48 [ [ \1 ] => [ \"1.0" ] ],
50 [ [ 1, undef, 3 ] => [ 1, 2, 3 ] ],
51 [ [ 1, 2, undef ] => [ 1, 2 ] ],
54 [ { a => undef } => { } ],
55 [ { a => undef } => { a => 0 } ],
56 [ { a => undef } => { a => '' } ],
57 [ { a => 0 } => { } ],
58 [ { a => 0 } => { a => '' } ],
59 [ { a => '' } => { } ],
61 [ { a => 1 } => { 'A' => 1 } ],
62 [ { a => 1 } => { 'a' => \"1.0" } ],
64 [ [ { a => 1 }, 2, { b => \3 } ] => [ { a => 1 }, 2, { b => \'3.0' } ] ],
66 [ $scalar_ref => "$scalar_ref" ],
67 [ $array_ref => "$array_ref" ],
68 [ $hash_ref => "$hash_ref" ],
69 [ $code_ref => "$code_ref" ],
73 package Test::Leaner::TestIsDeeplyObject;
83 Test::Leaner::TestIsDeeplyObject->new(a => 1),
84 Test::Leaner::TestIsDeeplyObject->new(a => 2),
88 package Test::Leaner::TestIsDeeplyOverload;
90 use overload 'eq' => sub {
94 $y = $y->{str} if ref $y;
96 ($x, $y) = ($y, $x) if $r;
101 sub new { bless { str => $_[1] }, $_[0] }
105 [ map Test::Leaner::TestIsDeeplyOverload->new($_), qw<abc def> ],
106 [ 'abc' => Test::Leaner::TestIsDeeplyOverload->new('abc') ],
112 $_, [ $_->[1], $_->[0] ]
118 my $ret = eval { Test::Leaner::is_deeply($t->[0], $t->[1]) };
119 ++$count if $@ eq '';
120 is $@, '', 'is_deeply(...) does not croak';
121 ok !$ret, 'is_deeply(...) returns false';
122 is $buf, "not ok $count\n", 'is_deeply(...) produces the correct TAP code';