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