File Coverage

File:local/lib/perl5/Test/Deep/ArrayElementsOnly.pm
Coverage:72.5%

linestmtbrancondsubtimecode
1
2
2
2
5
2
35
use strict;
2
2
2
2
5
2
31
use warnings;
3
4package Test::Deep::ArrayElementsOnly;
5
6
2
2
2
5
0
6
use Test::Deep::Ref;
7
8sub init
9{
10
22
18
        my $self = shift;
11
12
22
8
        my $val = shift;
13
14
22
122
        $self->{val} = $val;
15}
16
17sub descend
18{
19
22
14
        my $self = shift;
20
22
16
        my $got = shift;
21
22
22
10
        my $exp = $self->{val};
23
24
22
29
        my $data = $self->data;
25
26
22
22
11
52
        for my $i (0..$#{$exp})
27        {
28
40
27
                $data->{index} = $i;
29
30
40
26
                my $got_elem = $got->[$i];
31
40
21
                my $exp_elem = $exp->[$i];
32
33
40
35
                return 0 unless Test::Deep::descend($got_elem, $exp_elem)
34        }
35
36
22
28
        return 1;
37}
38
39sub render_stack
40{
41
0
        my $self = shift;
42
0
        my ($var, $data) = @_;
43
0
        $var .= "->" unless $Test::Deep::Stack->incArrow;
44
0
        $var .= "[$data->{index}]";
45
46
0
        return $var;
47}
48
49sub reset_arrow
50{
51
0
        return 0;
52}
53
541;