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