File Coverage

inc/Test/Deep/HashKeys.pm
Criterion Covered Total %
statement 29 37 78.3
branch 1 2 50.0
condition n/a
subroutine 8 10 80.0
pod 0 3 0.0
total 38 52 73.0


line stmt bran cond sub pod time code
1 2     2   9 #line 1
  2         4  
  2         81  
2 2     2   13 use strict;
  2         3  
  2         58  
3             use warnings;
4              
5             package Test::Deep::HashKeys;
6 2     2   10  
  2         3  
  2         10  
7             use Test::Deep::Ref;
8              
9             sub init
10 6     6 0 13 {
11             my $self = shift;
12 6         7  
13 6         17 my %keys;
14 6         367 @keys{@_} = ();
15 6         32 $self->{val} = \%keys;
16             $self->{keys} = [sort @_];
17             }
18              
19             sub descend
20 6     6 0 11 {
21 6         8 my $self = shift;
22             my $got = shift;
23 6         11  
24             my $exp = $self->{val};
25 6 50       29  
26             return 0 unless $self->test_reftype($got, "HASH");
27 6         43  
28             return Test::Deep::descend($got, $self->hashkeysonly($exp));
29             }
30              
31             sub hashkeysonly
32 6     6 0 1378 {
33             require Test::Deep::HashKeysOnly;
34 6         14  
35 6         9 my $self = shift;
36             my $exp = shift;
37 6         41  
38             return Test::Deep::HashKeysOnly->new(keys %$exp)
39             }
40              
41             package Test::Deep::SuperHashKeys;
42 2     2   10  
  2         3  
  2         12  
43             use base 'Test::Deep::HashKeys';
44              
45             sub hashkeysonly
46 0     0     {
47             require Test::Deep::HashKeysOnly;
48 0            
49 0           my $self = shift;
50             my $exp = shift;
51 0            
52             return Test::Deep::SuperHashKeysOnly->new(keys %$exp)
53             }
54              
55             package Test::Deep::SubHashKeys;
56 2     2   15  
  2         4  
  2         6  
57             use base 'Test::Deep::HashKeys';
58              
59             sub hashkeysonly
60 0     0     {
61             require Test::Deep::HashKeysOnly;
62 0            
63 0           my $self = shift;
64             my $exp = shift;
65 0            
66             return Test::Deep::SubHashKeysOnly->new(keys %$exp)
67             }
68              
69             1;