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