File: | local/lib/perl5/Test/Deep/RefType.pm |
Coverage: | 75.8% |
line | stmt | bran | cond | sub | time | code |
---|---|---|---|---|---|---|
1 | 2 2 2 | 5 1 35 | use strict; | |||
2 | 2 2 2 | 5 1 30 | use warnings; | |||
3 | ||||||
4 | package Test::Deep::RefType; | |||||
5 | ||||||
6 | 2 2 2 | 5 2 4 | use Test::Deep::Cmp; | |||
7 | ||||||
8 | 2 2 2 | 5 1 240 | use Scalar::Util qw( reftype ); | |||
9 | ||||||
10 | sub init | |||||
11 | { | |||||
12 | 22 | 17 | my $self = shift; | |||
13 | ||||||
14 | 22 | 85 | $self->{val} = shift; | |||
15 | } | |||||
16 | ||||||
17 | sub descend | |||||
18 | { | |||||
19 | 22 | 16 | my $self = shift; | |||
20 | ||||||
21 | 22 | 11 | my $got = shift; | |||
22 | ||||||
23 | 22 | 15 | my $exp = $self->{val}; | |||
24 | 22 | 15 | my $reftype = reftype($got); | |||
25 | ||||||
26 | 22 | 38 | return Test::Deep::descend($reftype, Test::Deep::shallow($exp)); | |||
27 | } | |||||
28 | ||||||
29 | sub render_stack | |||||
30 | { | |||||
31 | 0 | my $self = shift; | ||||
32 | 0 | my $var = shift; | ||||
33 | ||||||
34 | 0 | return "reftype($var)"; | ||||
35 | } | |||||
36 | ||||||
37 | sub renderGot | |||||
38 | { | |||||
39 | 0 | my $self = shift; | ||||
40 | ||||||
41 | 0 | my $got = shift; | ||||
42 | ||||||
43 | 0 | $self->SUPER::renderGot(reftype($got)); | ||||
44 | } | |||||
45 | ||||||
46 | 1; |