line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Difflet; |
2
|
1
|
|
|
1
|
|
13709
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
4
|
1
|
|
|
1
|
|
3
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
5
|
1
|
|
|
1
|
|
17
|
use Test::More; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
3
|
|
6
|
1
|
|
|
1
|
|
506
|
use Data::Difflet; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
7
|
1
|
|
|
1
|
|
4
|
use Data::Dumper; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
47
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub import { |
10
|
1
|
|
|
1
|
|
6
|
my $class = shift; |
11
|
1
|
|
|
|
|
2
|
my $pkg = caller(0); |
12
|
1
|
|
|
1
|
|
4
|
no strict 'refs'; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
33
|
|
13
|
1
|
|
|
|
|
1
|
for (@_) { |
14
|
1
|
50
|
|
|
|
3
|
if ($_ eq 'is_deeply') { |
15
|
1
|
|
|
1
|
|
3
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
205
|
|
16
|
1
|
|
|
|
|
2
|
*{"${pkg}::is_deeply"} = \&difflet_is_deeply; |
|
1
|
|
|
|
|
3
|
|
17
|
1
|
|
|
|
|
3
|
*Test::More::is_deeply = \&difflet_is_deeply; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
} |
20
|
1
|
|
|
|
|
1
|
*{"${pkg}::difflet_is_deeply"} = \&difflet_is_deeply; |
|
1
|
|
|
|
|
971
|
|
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub difflet_is_deeply { |
24
|
1
|
|
|
1
|
0
|
14
|
my ($got, $expected, $msg) = @_; |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
16
|
my $builder = Test::More->builder; |
27
|
1
|
|
|
|
|
46
|
local $Test::Builder::Level = $Test::Builder::Level + 1; |
28
|
1
|
50
|
33
|
|
|
22
|
if (-t *STDOUT || $ENV{HARNESS_ACTIVE}) { |
29
|
1
|
50
|
|
|
|
5
|
if (_eq_deeply($got, $expected)) { |
30
|
1
|
|
|
|
|
187
|
$builder->ok(1, $msg); |
31
|
|
|
|
|
|
|
} else { |
32
|
0
|
|
|
|
|
0
|
my $difflet = Data::Difflet->new(); |
33
|
0
|
|
|
|
|
0
|
$builder->ok(0, $msg); |
34
|
0
|
|
|
|
|
0
|
$builder->diag($difflet->compare($got, $expected)); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} else { |
37
|
0
|
|
|
|
|
0
|
is_deeply($got, $expected, $msg); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _eq_deeply { |
42
|
1
|
|
|
1
|
|
3
|
my ($a, $b) = @_; |
43
|
1
|
|
|
|
|
2
|
local $Data::Dumper::Terse = 1; |
44
|
1
|
|
|
|
|
2
|
local $Data::Dumper::Indent = 0; |
45
|
1
|
|
|
|
|
3
|
local $Data::Dumper::Sortkeys = 1; |
46
|
1
|
|
|
|
|
5
|
return Dumper($a) eq Dumper($b); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
__END__ |