line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Deep::JSON; |
2
|
2
|
|
|
2
|
|
78287
|
use strict; |
|
2
|
|
|
|
|
17
|
|
|
2
|
|
|
|
|
53
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
72
|
|
4
|
2
|
|
|
2
|
|
49
|
use 5.008_001; |
|
2
|
|
|
|
|
6
|
|
5
|
2
|
|
|
2
|
|
341
|
use Test::Deep (); |
|
2
|
|
|
|
|
7251
|
|
|
2
|
|
|
|
|
44
|
|
6
|
2
|
|
|
2
|
|
492
|
use Test::Deep::Cmp; |
|
2
|
|
|
|
|
1123
|
|
|
2
|
|
|
|
|
8
|
|
7
|
2
|
|
|
2
|
|
1237
|
use JSON; |
|
2
|
|
|
|
|
14318
|
|
|
2
|
|
|
|
|
11
|
|
8
|
2
|
|
|
2
|
|
839
|
use Exporter::Lite; |
|
2
|
|
|
|
|
1067
|
|
|
2
|
|
|
|
|
11
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw(json); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub json ($) { |
15
|
6
|
|
|
6
|
1
|
25439
|
my ($expected) = @_; |
16
|
6
|
|
|
|
|
43
|
return __PACKAGE__->new($expected); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub init { |
20
|
6
|
|
|
6
|
0
|
56
|
my ($self, $expected) = @_; |
21
|
6
|
|
|
|
|
61
|
$self->{val} = $expected; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub descend { |
25
|
6
|
|
|
6
|
0
|
13050
|
my ($self, $got) = @_; |
26
|
6
|
|
|
|
|
11
|
my $parsed = eval { decode_json($got) }; |
|
6
|
|
|
|
|
68
|
|
27
|
6
|
100
|
|
|
|
22
|
if ($@) { |
28
|
1
|
|
|
|
|
4
|
$self->{error} = $@; |
29
|
1
|
|
|
|
|
17
|
return 0; |
30
|
|
|
|
|
|
|
} |
31
|
5
|
|
|
|
|
17
|
return Test::Deep::wrap($self->{val})->descend($parsed); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub diagnostics { |
35
|
2
|
|
|
2
|
0
|
1088
|
my $self = shift; |
36
|
2
|
100
|
66
|
|
|
15
|
return $self->{error} if defined $self->{error} && length $self->{error}; |
37
|
1
|
|
|
|
|
18
|
return $self->{val}->diagnostics(@_); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |