line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
4
|
#line 1 |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
3
|
|
|
|
|
|
|
use warnings; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Test::Deep::HashKeysOnly; |
6
|
1
|
|
|
1
|
|
6
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
use Test::Deep::Ref; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub init |
10
|
4
|
|
|
4
|
0
|
7
|
{ |
11
|
|
|
|
|
|
|
my $self = shift; |
12
|
4
|
|
|
|
|
6
|
|
13
|
4
|
|
|
|
|
13
|
my %keys; |
14
|
4
|
|
|
|
|
94
|
@keys{@_} = (); |
15
|
4
|
|
|
|
|
22
|
$self->{val} = \%keys; |
16
|
|
|
|
|
|
|
$self->{keys} = [sort @_]; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub descend |
20
|
4
|
|
|
4
|
0
|
5
|
{ |
21
|
4
|
|
|
|
|
6
|
my $self = shift; |
22
|
|
|
|
|
|
|
my $hash = shift; |
23
|
4
|
|
|
|
|
13
|
|
24
|
4
|
|
|
|
|
7
|
my $data = $self->data; |
25
|
4
|
|
|
|
|
6
|
my $exp = $self->{val}; |
26
|
4
|
|
|
|
|
14
|
my %got; |
27
|
|
|
|
|
|
|
@got{keys %$hash} = (); |
28
|
4
|
|
|
|
|
9
|
|
29
|
|
|
|
|
|
|
my @missing; |
30
|
|
|
|
|
|
|
my @extra; |
31
|
4
|
|
|
|
|
15
|
|
32
|
|
|
|
|
|
|
while (my ($key, $value) = each %$exp) |
33
|
18
|
50
|
|
|
|
28
|
{ |
34
|
|
|
|
|
|
|
if (exists $got{$key}) |
35
|
18
|
|
|
|
|
49
|
{ |
36
|
|
|
|
|
|
|
delete $got{$key}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else |
39
|
0
|
|
|
|
|
0
|
{ |
40
|
|
|
|
|
|
|
push(@missing, $key); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
4
|
|
|
|
|
6
|
|
44
|
4
|
50
|
33
|
|
|
13
|
my @diags; |
45
|
|
|
|
|
|
|
if (@missing and (not $self->ignoreMissing)) |
46
|
0
|
|
|
|
|
0
|
{ |
47
|
|
|
|
|
|
|
push(@diags, "Missing: ".nice_list(\@missing)); |
48
|
|
|
|
|
|
|
} |
49
|
4
|
50
|
33
|
|
|
13
|
|
50
|
|
|
|
|
|
|
if (%got and (not $self->ignoreExtra)) |
51
|
0
|
|
|
|
|
0
|
{ |
52
|
|
|
|
|
|
|
push(@diags, "Extra: ".nice_list([keys %got])); |
53
|
|
|
|
|
|
|
} |
54
|
4
|
50
|
|
|
|
11
|
|
55
|
|
|
|
|
|
|
if (@diags) |
56
|
0
|
|
|
|
|
0
|
{ |
57
|
0
|
|
|
|
|
0
|
$data->{diag} = join("\n", @diags); |
58
|
|
|
|
|
|
|
return 0; |
59
|
|
|
|
|
|
|
} |
60
|
4
|
|
|
|
|
16
|
|
61
|
|
|
|
|
|
|
return 1; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub diagnostics |
65
|
0
|
|
|
0
|
0
|
|
{ |
66
|
0
|
|
|
|
|
|
my $self = shift; |
67
|
|
|
|
|
|
|
my ($where, $last) = @_; |
68
|
0
|
0
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my $type = $self->{IgnoreDupes} ? "Set" : "Bag"; |
70
|
0
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my $error = $last->{diag}; |
72
|
|
|
|
|
|
|
my $diag = <
|
73
|
|
|
|
|
|
|
Comparing hash keys of $where |
74
|
|
|
|
|
|
|
$error |
75
|
|
|
|
|
|
|
EOM |
76
|
0
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
return $diag; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub nice_list |
81
|
0
|
|
|
0
|
0
|
|
{ |
82
|
|
|
|
|
|
|
my $list = shift; |
83
|
0
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
return join(", ", |
85
|
|
|
|
|
|
|
(map {"'$_'"} sort @$list), |
86
|
|
|
|
|
|
|
); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub ignoreMissing |
90
|
0
|
|
|
0
|
0
|
|
{ |
91
|
|
|
|
|
|
|
return 0; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub ignoreExtra |
95
|
0
|
|
|
0
|
0
|
|
{ |
96
|
|
|
|
|
|
|
return 0; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
package Test::Deep::SuperHashKeysOnly; |
100
|
1
|
|
|
1
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
106
|
|
101
|
|
|
|
|
|
|
use base 'Test::Deep::HashKeysOnly'; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub ignoreMissing |
104
|
0
|
|
|
0
|
|
|
{ |
105
|
|
|
|
|
|
|
return 0; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub ignoreExtra |
109
|
0
|
|
|
0
|
|
|
{ |
110
|
|
|
|
|
|
|
return 1; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
package Test::Deep::SubHashKeysOnly; |
114
|
1
|
|
|
1
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
85
|
|
115
|
|
|
|
|
|
|
use base 'Test::Deep::HashKeysOnly'; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub ignoreMissing |
118
|
0
|
|
|
0
|
|
|
{ |
119
|
|
|
|
|
|
|
return 1; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub ignoreExtra |
123
|
0
|
|
|
0
|
|
|
{ |
124
|
|
|
|
|
|
|
return 0; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
1; |