line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
14418
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
65
|
|
2
|
1
|
|
|
1
|
|
9
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
82
|
|
3
|
|
|
|
|
|
|
package Test::Deep::YAML; # git description: v0.002-16-ge7eb62a |
4
|
|
|
|
|
|
|
# ABSTRACT: A Test::Deep plugin for comparing YAML-encoded data |
5
|
|
|
|
|
|
|
# KEYWORDS: testing tests plugin YAML data |
6
|
|
|
|
|
|
|
# vim: set ts=8 sts=4 sw=4 tw=78 et : |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.003'; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use Exporter 'import'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
140
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw(yaml); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub yaml |
15
|
|
|
|
|
|
|
{ |
16
|
9
|
|
|
9
|
1
|
20932
|
my ($expected) = @_; |
17
|
9
|
|
|
|
|
35
|
return Test::Deep::YAML::Object->new($expected); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
package # hide from PAUSE |
21
|
|
|
|
|
|
|
Test::Deep::YAML::Object; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.003'; |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
672
|
use parent 'Test::Deep::Cmp'; |
|
1
|
|
|
|
|
346
|
|
|
1
|
|
|
|
|
5
|
|
26
|
1
|
|
|
1
|
|
710912
|
use Try::Tiny (); |
|
1
|
|
|
|
|
1390
|
|
|
1
|
|
|
|
|
19
|
|
27
|
1
|
|
|
1
|
|
510
|
use YAML (); |
|
1
|
|
|
|
|
5001
|
|
|
1
|
|
|
|
|
303
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub init |
30
|
|
|
|
|
|
|
{ |
31
|
9
|
|
|
9
|
|
37
|
my ($self, $expected) = @_; |
32
|
9
|
|
|
|
|
60
|
$self->{val} = $expected; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub descend |
36
|
|
|
|
|
|
|
{ |
37
|
9
|
|
|
9
|
|
17209
|
my ($self, $got) = @_; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $data = Try::Tiny::try |
40
|
|
|
|
|
|
|
{ |
41
|
9
|
|
|
9
|
|
253
|
YAML::Load($got); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
Try::Tiny::catch |
44
|
|
|
|
|
|
|
{ |
45
|
1
|
|
|
1
|
|
12541
|
chomp($self->{error_message} = $_); |
46
|
1
|
|
|
|
|
4
|
undef; |
47
|
9
|
|
|
|
|
67
|
}; |
48
|
|
|
|
|
|
|
|
49
|
9
|
100
|
66
|
|
|
6835
|
return 0 if not $data or $self->{error_message}; |
50
|
|
|
|
|
|
|
|
51
|
8
|
|
|
|
|
30
|
return Test::Deep::wrap($self->{val})->descend($data); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub diagnostics |
55
|
|
|
|
|
|
|
{ |
56
|
2
|
|
|
2
|
|
697
|
my ($self, $where, $last) = @_; |
57
|
2
|
|
66
|
|
|
13
|
return $self->{error_message} |
58
|
|
|
|
|
|
|
|| $self->{val}->diagnostics($where, $last); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |