| 1 | 5 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 5 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | package Test::Deep::HashElements 1.205; | ||||||||||
| 5 | |||||||||||
| 6 | 5 | ▶ | use Test::Deep::Ref; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | sub init | ||||||||||
| 9 | 13 | ▶ | { | ||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 10 | 13 | my $self = shift; | |||||||||
| 11 | |||||||||||
| 12 | 13 | my $val = shift; | |||||||||
| 13 | |||||||||||
| 14 | 13 | $self->{val} = $val; | |||||||||
| 15 | } | ||||||||||
| 16 | |||||||||||
| 17 | sub descend | ||||||||||
| 18 | 13 | ▶ | { | ||||||||
|
Subroutine
descend: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||
| 19 | 13 | my $self = shift; | |||||||||
| 20 | |||||||||||
| 21 | 13 | my $got = shift; | |||||||||
| 22 | |||||||||||
| 23 | 13 | my $exp = $self->{val}; | |||||||||
| 24 | |||||||||||
| 25 | 13 | my $data = $self->data; | |||||||||
| 26 | |||||||||||
| 27 | 13 | my $master = $self->getMaster($got, $exp); | |||||||||
| 28 | |||||||||||
| 29 | 13 | foreach my $key (sort keys %$master) | |||||||||
| 30 | { | ||||||||||
| 31 | 15 | $data->{index} = $key; | |||||||||
| 32 | |||||||||||
| 33 | 15 | ▶ | my $got_elem = exists $got->{$key} ? $got->{$key} : $Test::Deep::DNE; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 15 | ▶ | my $exp_elem = exists $exp->{$key} ? $exp->{$key} : $Test::Deep::DNE; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | |||||||||||
| 36 | 15 | ▶ | next if Test::Deep::descend($got_elem, $exp_elem); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | |||||||||||
| 38 | 4 | return 0; | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 9 | return 1; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | sub getMaster | ||||||||||
| 45 | 11 | ▶ | { | ||||||||
|
Subroutine
getMaster: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 46 | 11 | my $self = shift; | |||||||||
| 47 | |||||||||||
| 48 | 11 | my ($got, $exp) = @_; | |||||||||
| 49 | |||||||||||
| 50 | 11 | ▶ | return keys %$got > keys %$exp ? $got : $exp; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | sub render_stack | ||||||||||
| 54 | 4 | ▶ | { | ||||||||
|
Subroutine
render_stack: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 55 | 4 | my $self = shift; | |||||||||
| 56 | 4 | my ($var, $data) = @_; | |||||||||
| 57 | 4 | ▶ | $var .= "->" unless $Test::Deep::Stack->incArrow; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | 4 | $var .= '{"'.quotemeta($data->{index}).'"}'; | |||||||||
| 59 | |||||||||||
| 60 | 4 | return $var; | |||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | sub reset_arrow | ||||||||||
| 64 | 4 | ▶ | { | ||||||||
|
Subroutine
reset_arrow: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 65 | 4 | return 0; | |||||||||
| 66 | } | ||||||||||
| 67 | |||||||||||
| 68 | package Test::Deep::SuperHashElements 1.205; | ||||||||||
| 69 | |||||||||||
| 70 | 5 | ▶ | use base 'Test::Deep::HashElements'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 71 | |||||||||||
| 72 | sub getMaster | ||||||||||
| 73 | 1 | ▶ | { | ||||||||
|
Subroutine
getMaster: called CC=1 SCAR=0.0
| |||||||||||
| 74 | 1 | my $self = shift; | |||||||||
| 75 | |||||||||||
| 76 | 1 | my ($got, $exp) = @_; | |||||||||
| 77 | |||||||||||
| 78 | 1 | return $exp; | |||||||||
| 79 | } | ||||||||||
| 80 | |||||||||||
| 81 | package Test::Deep::SubHashElements 1.205; | ||||||||||
| 82 | |||||||||||
| 83 | 5 | ▶ | use base 'Test::Deep::HashElements'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 84 | |||||||||||
| 85 | sub getMaster | ||||||||||
| 86 | 1 | ▶ | { | ||||||||
|
Subroutine
getMaster: called CC=1 SCAR=0.0
| |||||||||||
| 87 | 1 | my $self = shift; | |||||||||
| 88 | |||||||||||
| 89 | 1 | my ($got, $exp) = @_; | |||||||||
| 90 | |||||||||||
| 91 | 1 | return $got; | |||||||||
| 92 | } | ||||||||||
| 93 | |||||||||||
| 94 | 5 | 1; | |||||||||
| 95 | |||||||||||
| 96 | __END__ | ||||||||||