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 1     1   5 #line 1
  1         2  
  1         40  
2 1     1   6 use strict;
  1         2  
  1         38  
3             use warnings;
4              
5             package Test::Deep::HashKeys;
6 1     1   6  
  1         1  
  1         14  
7             use Test::Deep::Ref;
8              
9             sub init
10 44     44 0 58 {
11             my $self = shift;
12 44         58  
13 44         103 my %keys;
14 44         299 @keys{@_} = ();
15 44         202 $self->{val} = \%keys;
16             $self->{keys} = [sort @_];
17             }
18              
19             sub descend
20 44     44 0 58 {
21 44         45 my $self = shift;
22             my $got = shift;
23 44         97  
24             my $exp = $self->{val};
25 44 50       152  
26             return 0 unless $self->test_reftype($got, "HASH");
27 44         157  
28             return Test::Deep::descend($got, $self->hashkeysonly($exp));
29             }
30              
31             sub hashkeysonly
32 44     44 0 742 {
33             require Test::Deep::HashKeysOnly;
34 44         71  
35 44         51 my $self = shift;
36             my $exp = shift;
37 44         187  
38             return Test::Deep::HashKeysOnly->new(keys %$exp)
39             }
40              
41             package Test::Deep::SuperHashKeys;
42 1     1   5  
  1         1  
  1         5  
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 1     1   6  
  1         2  
  1         4  
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;