File Coverage

blib/lib/Test/Deep/Hash.pm
Criterion Covered Total %
statement 47 47 100.0
branch 4 4 100.0
condition n/a
subroutine 14 14 100.0
pod 0 5 0.0
total 65 70 92.8


line stmt bran cond sub pod time code
1 7     7   69 use strict;
  7         18  
  7         371  
2 7     7   95 use warnings;
  7         15  
  7         596  
3              
4             package Test::Deep::Hash 1.205;
5              
6 7     7   570 use Test::Deep::Ref;
  7         17  
  7         60  
7              
8             sub init
9             {
10 30     30 0 51 my $self = shift;
11              
12 30         52 my $val = shift;
13              
14 30         846 $self->{val} = $val;
15             }
16              
17             sub descend
18             {
19 38     38 0 81 my $self = shift;
20              
21 38         63 my $got = shift;
22              
23 38         74 my $exp = $self->{val};
24              
25 38         126 my $data = $self->data;
26              
27 38 100       101 return 0 unless Test::Deep::descend($got, $self->hash_keys($exp));
28              
29 16 100       76 return 0 unless $self->test_class($got);
30              
31 13         39 return Test::Deep::descend($got, $self->hash_elements($exp));
32             }
33              
34             sub hash_elements
35             {
36 11     11 0 2751 require Test::Deep::HashElements;
37              
38 11         31 my $self = shift;
39              
40 11         71 return Test::Deep::HashElements->new(@_);
41             }
42              
43             sub hash_keys
44             {
45 36     36 0 4316 require Test::Deep::HashKeys;
46              
47 36         188 my $self = shift;
48 36         61 my $exp = shift;
49              
50 36         195 return Test::Deep::HashKeys->new(keys %$exp);
51             }
52              
53             sub reset_arrow
54             {
55 8     8 0 26 return 0;
56             }
57              
58             package Test::Deep::SuperHash 1.205;
59              
60 7     7   55 use base 'Test::Deep::Hash';
  7         16  
  7         2020  
61              
62             sub hash_elements
63             {
64 1     1   3 require Test::Deep::HashElements;
65              
66 1         2 my $self = shift;
67              
68 1         6 return Test::Deep::SuperHashElements->new(@_);
69             }
70              
71             sub hash_keys
72             {
73 1     1   6 require Test::Deep::HashKeys;
74              
75 1         2 my $self = shift;
76 1         1 my $exp = shift;
77              
78 1         11 return Test::Deep::SuperHashKeys->new(keys %$exp);
79             }
80              
81             package Test::Deep::SubHash 1.205;
82              
83 7     7   54 use base 'Test::Deep::Hash';
  7         19  
  7         1581  
84              
85             sub hash_elements
86             {
87 1     1   5 require Test::Deep::HashElements;
88              
89 1         2 my $self = shift;
90              
91 1         7 return Test::Deep::SubHashElements->new(@_);
92             }
93              
94             sub hash_keys
95             {
96 1     1   8 require Test::Deep::HashKeys;
97              
98 1         3 my $self = shift;
99 1         3 my $exp = shift;
100              
101 1         13 return Test::Deep::SubHashKeys->new(keys %$exp);
102             }
103              
104             1;
105              
106             __END__