line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
7
|
#line 1 |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
39
|
|
3
|
|
|
|
|
|
|
use warnings; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Test::Deep::HashKeysOnly; |
6
|
1
|
|
|
1
|
|
7
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
11
|
|
7
|
|
|
|
|
|
|
use Test::Deep::Ref; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub init |
10
|
3
|
|
|
3
|
0
|
5
|
{ |
11
|
|
|
|
|
|
|
my $self = shift; |
12
|
3
|
|
|
|
|
6
|
|
13
|
3
|
|
|
|
|
8
|
my %keys; |
14
|
3
|
|
|
|
|
124
|
@keys{@_} = (); |
15
|
3
|
|
|
|
|
17
|
$self->{val} = \%keys; |
16
|
|
|
|
|
|
|
$self->{keys} = [sort @_]; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub descend |
20
|
3
|
|
|
3
|
0
|
8
|
{ |
21
|
3
|
|
|
|
|
6
|
my $self = shift; |
22
|
|
|
|
|
|
|
my $hash = shift; |
23
|
3
|
|
|
|
|
18
|
|
24
|
3
|
|
|
|
|
8
|
my $data = $self->data; |
25
|
3
|
|
|
|
|
5
|
my $exp = $self->{val}; |
26
|
3
|
|
|
|
|
7
|
my %got; |
27
|
|
|
|
|
|
|
@got{keys %$hash} = (); |
28
|
3
|
|
|
|
|
5
|
|
29
|
|
|
|
|
|
|
my @missing; |
30
|
|
|
|
|
|
|
my @extra; |
31
|
3
|
|
|
|
|
16
|
|
32
|
|
|
|
|
|
|
while (my ($key, $value) = each %$exp) |
33
|
1
|
50
|
|
|
|
7
|
{ |
34
|
|
|
|
|
|
|
if (exists $got{$key}) |
35
|
1
|
|
|
|
|
6
|
{ |
36
|
|
|
|
|
|
|
delete $got{$key}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else |
39
|
0
|
|
|
|
|
0
|
{ |
40
|
|
|
|
|
|
|
push(@missing, $key); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
3
|
|
|
|
|
7
|
|
44
|
3
|
50
|
33
|
|
|
10
|
my @diags; |
45
|
|
|
|
|
|
|
if (@missing and (not $self->ignoreMissing)) |
46
|
0
|
|
|
|
|
0
|
{ |
47
|
|
|
|
|
|
|
push(@diags, "Missing: ".nice_list(\@missing)); |
48
|
|
|
|
|
|
|
} |
49
|
3
|
50
|
33
|
|
|
12
|
|
50
|
|
|
|
|
|
|
if (%got and (not $self->ignoreExtra)) |
51
|
0
|
|
|
|
|
0
|
{ |
52
|
|
|
|
|
|
|
push(@diags, "Extra: ".nice_list([keys %got])); |
53
|
|
|
|
|
|
|
} |
54
|
3
|
50
|
|
|
|
10
|
|
55
|
|
|
|
|
|
|
if (@diags) |
56
|
0
|
|
|
|
|
0
|
{ |
57
|
0
|
|
|
|
|
0
|
$data->{diag} = join("\n", @diags); |
58
|
|
|
|
|
|
|
return 0; |
59
|
|
|
|
|
|
|
} |
60
|
3
|
|
|
|
|
15
|
|
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
|
|
8
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
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
|
|
10
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
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; |