6 use Test::Leaner tests => 21 + 2 + 1 + 2;
8 my $lacunary = [ [ 1, 2, 3 ] => [ 1, 2, 3 ] ];
9 delete $lacunary->[0]->[1];
10 $lacunary->[1]->[1] = undef;
15 my $code_ref = sub { };
26 [ \(\'a') => \(\'a') ],
29 [ [ 'a' ] => [ 'a' ] ],
32 [ [ 1, 2, 3 ] => [ 1, 2, 3 ] ],
33 [ [ 1, undef, 3 ] => [ 1, undef, 3 ] ],
36 [ { a => 1 } => { a => 1 } ],
37 [ { a => undef } => { a => undef } ],
38 [ { a => \1 } => { a => \1 } ],
40 [ { a => [ 1, undef, 2 ], b => \3 } => { a => [ 1, undef, 2 ], b => \3 } ],
42 [ $scalar_ref => $scalar_ref ],
43 [ $array_ref => $array_ref ],
44 [ $hash_ref => $hash_ref ],
45 [ $code_ref => $code_ref ],
48 # Test breaking encapsulation
51 package Test::Leaner::TestIsDeeplyObject;
61 package Test::Leaner::TestIsDeeplyObject2;
71 [ map Test::Leaner::TestIsDeeplyObject->new(
72 a => [ 1, { b => 2, c => undef }, undef, \3 ],
73 c => { d => \(\4), e => [ 5, undef ] },
76 Test::Leaner::TestIsDeeplyObject->new(a => 1),
77 Test::Leaner::TestIsDeeplyObject2->new(a => 1),
82 package Test::Leaner::TestIsDeeplyOverload;
84 use overload 'eq' => sub {
88 $y = $y->{str} if ref $y;
90 ($x, $y) = ($y, $x) if $r;
95 sub new { bless { str => $_[1] }, $_[0] }
98 push @tests, [ map Test::Leaner::TestIsDeeplyOverload->new('foo'), 1 .. 2 ];
101 is_deeply $t->[0], $t->[1];
104 # Test vivification of deleted elements of an array
109 is_deeply \@l, [ 1, undef, 3 ];
111 is_deeply \@l, [ 1 ];