line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Deep::JSON; |
2
|
2
|
|
|
2
|
|
88669
|
use strict; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
57
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
48
|
|
4
|
2
|
|
|
2
|
|
49
|
use 5.008_001; |
|
2
|
|
|
|
|
7
|
|
5
|
2
|
|
|
2
|
|
662
|
use Test::Deep (); |
|
2
|
|
|
|
|
9236
|
|
|
2
|
|
|
|
|
54
|
|
6
|
2
|
|
|
2
|
|
988
|
use Test::Deep::Cmp; |
|
2
|
|
|
|
|
1413
|
|
|
2
|
|
|
|
|
13
|
|
7
|
2
|
|
|
2
|
|
553
|
use JSON::MaybeXS; |
|
2
|
|
|
|
|
5786
|
|
|
2
|
|
|
|
|
112
|
|
8
|
2
|
|
|
2
|
|
1045
|
use Exporter::Lite; |
|
2
|
|
|
|
|
1492
|
|
|
2
|
|
|
|
|
11
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw(json); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub json ($) { |
15
|
6
|
|
|
6
|
1
|
25544
|
my ($expected) = @_; |
16
|
6
|
|
|
|
|
30
|
return __PACKAGE__->new($expected); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub init { |
20
|
6
|
|
|
6
|
0
|
42
|
my ($self, $expected) = @_; |
21
|
6
|
|
|
|
|
50
|
$self->{val} = $expected; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub descend { |
25
|
6
|
|
|
6
|
0
|
15081
|
my ($self, $got) = @_; |
26
|
6
|
|
|
|
|
10
|
my $parsed = eval { decode_json($got) }; |
|
6
|
|
|
|
|
55
|
|
27
|
6
|
100
|
|
|
|
19
|
if ($@) { |
28
|
1
|
|
|
|
|
4
|
$self->{error} = $@; |
29
|
1
|
|
|
|
|
15
|
return 0; |
30
|
|
|
|
|
|
|
} |
31
|
5
|
|
|
|
|
16
|
return Test::Deep::wrap($self->{val})->descend($parsed); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub diagnostics { |
35
|
2
|
|
|
2
|
0
|
1093
|
my $self = shift; |
36
|
2
|
100
|
66
|
|
|
18
|
return $self->{error} if defined $self->{error} && length $self->{error}; |
37
|
1
|
|
|
|
|
15
|
return $self->{val}->diagnostics(@_); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |