line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
13766
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
2
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
47
|
|
3
|
|
|
|
|
|
|
package Test::Deep::YAML; # git description: v0.003-2-g42e13ef |
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.004'; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use Exporter 'import'; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
80
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw(yaml); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub yaml |
15
|
|
|
|
|
|
|
{ |
16
|
9
|
|
|
9
|
1
|
18642
|
my ($expected) = @_; |
17
|
9
|
|
|
|
|
30
|
return Test::Deep::YAML::Object->new($expected); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
package # hide from PAUSE |
21
|
|
|
|
|
|
|
Test::Deep::YAML::Object; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.004'; |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
336
|
use parent 'Test::Deep::Cmp'; |
|
1
|
|
|
|
|
213
|
|
|
1
|
|
|
|
|
4
|
|
26
|
1
|
|
|
1
|
|
3295
|
use Try::Tiny (); |
|
1
|
|
|
|
|
1013
|
|
|
1
|
|
|
|
|
14
|
|
27
|
1
|
|
|
1
|
|
462
|
use YAML (); |
|
1
|
|
|
|
|
4154
|
|
|
1
|
|
|
|
|
143
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub init |
30
|
|
|
|
|
|
|
{ |
31
|
9
|
|
|
9
|
|
39
|
my ($self, $expected) = @_; |
32
|
9
|
|
|
|
|
61
|
$self->{val} = $expected; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub descend |
36
|
|
|
|
|
|
|
{ |
37
|
9
|
|
|
9
|
|
19052
|
my ($self, $got) = @_; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $data = Try::Tiny::try |
40
|
|
|
|
|
|
|
{ |
41
|
9
|
|
|
9
|
|
213
|
YAML::Load($got); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
Try::Tiny::catch |
44
|
|
|
|
|
|
|
{ |
45
|
1
|
|
|
1
|
|
11984
|
chomp($self->{error_message} = $_); |
46
|
1
|
|
|
|
|
5
|
undef; |
47
|
9
|
|
|
|
|
55
|
}; |
48
|
|
|
|
|
|
|
|
49
|
9
|
100
|
66
|
|
|
6408
|
return 0 if not $data or $self->{error_message}; |
50
|
|
|
|
|
|
|
|
51
|
8
|
|
|
|
|
25
|
return Test::Deep::wrap($self->{val})->descend($data); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub diagnostics |
55
|
|
|
|
|
|
|
{ |
56
|
2
|
|
|
2
|
|
922
|
my ($self, $where, $last) = @_; |
57
|
2
|
|
66
|
|
|
12
|
return $self->{error_message} |
58
|
|
|
|
|
|
|
|| $self->{val}->diagnostics($where, $last); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |