15
is_deeply $h = { a => 1 }->diff, { a => 1 };
16
is_deeply $h = {}->diff(), {};
17
is_deeply $h = {}->diff( {} ), {};
18
throws_ok { $h = {}->diff('foo') } qr/Arguments must be/;
22
my %first = ( foo => 1, bar => 2, baz => 3 );
24
my %second = (foo => 1, baz => 2);
26
my %diff = %first->diff(\%second);
28
is_deeply \%diff, { bar => 2, baz => 3 };
32
my %first = ( foo => { bar => 1 }, baz => 3 );
33
my %second = ( foo => 2, baz => 3 );
34
my %third = ( foo => { bar => 2 }, quux => [ 'hai' ] );
36
my %diff = %first->diff(\%second, \%third);
38
is_deeply \%diff, { foo => { bar => 1 } };