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 * (30 + 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, undef, 3 ] => [ 1, 2, 3 ] ],
49 [ [ 1, 2, undef ] => [ 1, 2 ] ],
52 [ { a => undef } => { } ],
53 [ { a => undef } => { a => 0 } ],
54 [ { a => undef } => { a => '' } ],
55 [ { a => 0 } => { } ],
56 [ { a => 0 } => { a => '' } ],
57 [ { a => '' } => { } ],
59 [ { a => 1 } => { 'A' => 1 } ],
61 [ [ { a => 1 }, 2, { b => \3 } ] => [ { a => 1 }, 2, { b => \'3.0' } ] ],
63 [ $scalar_ref => "$scalar_ref" ],
64 [ $array_ref => "$array_ref" ],
65 [ $hash_ref => "$hash_ref" ],
66 [ $code_ref => "$code_ref" ],
70 package Test::Leaner::TestIsDeeplyObject;
80 Test::Leaner::TestIsDeeplyObject->new(a => 1),
81 Test::Leaner::TestIsDeeplyObject->new(a => 2),
85 package Test::Leaner::TestIsDeeplyOverload;
87 use overload 'eq' => sub {
91 $y = $y->{str} if ref $y;
93 ($x, $y) = ($y, $x) if $r;
98 sub new { bless { str => $_[1] }, $_[0] }
102 [ map Test::Leaner::TestIsDeeplyOverload->new($_), qw<abc def> ],
103 [ 'abc' => Test::Leaner::TestIsDeeplyOverload->new('abc') ],
109 $_, [ $_->[1], $_->[0] ]
115 my $ret = eval { Test::Leaner::is_deeply($t->[0], $t->[1]) };
116 ++$count if $@ eq '';
117 is $@, '', 'is_deeply(...) does not croak';
118 ok !$ret, 'is_deeply(...) returns false';
119 is $buf, "not ok $count\n", 'is_deeply(...) produces the correct TAP code';