line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Compare::Isa; |
2
|
168
|
|
|
168
|
|
1021
|
use strict; |
|
168
|
|
|
|
|
316
|
|
|
168
|
|
|
|
|
4363
|
|
3
|
168
|
|
|
168
|
|
796
|
use warnings; |
|
168
|
|
|
|
|
316
|
|
|
168
|
|
|
|
|
4077
|
|
4
|
|
|
|
|
|
|
|
5
|
168
|
|
|
168
|
|
780
|
use Carp qw/confess/; |
|
168
|
|
|
|
|
344
|
|
|
168
|
|
|
|
|
7160
|
|
6
|
168
|
|
|
168
|
|
900
|
use Scalar::Util qw/blessed/; |
|
168
|
|
|
|
|
344
|
|
|
168
|
|
|
|
|
6581
|
|
7
|
|
|
|
|
|
|
|
8
|
168
|
|
|
168
|
|
850
|
use base 'Test2::Compare::Base'; |
|
168
|
|
|
|
|
310
|
|
|
168
|
|
|
|
|
17585
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.000153'; |
11
|
|
|
|
|
|
|
|
12
|
168
|
|
|
168
|
|
1124
|
use Test2::Util::HashBase qw/input/; |
|
168
|
|
|
|
|
339
|
|
|
168
|
|
|
|
|
1000
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Overloads '!' for us. |
15
|
168
|
|
|
168
|
|
23461
|
use Test2::Compare::Negatable; |
|
168
|
|
|
|
|
331
|
|
|
168
|
|
|
|
|
937
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub init { |
18
|
10
|
|
|
10
|
0
|
297
|
my $self = shift; |
19
|
|
|
|
|
|
|
confess "input must be defined for 'Isa' check" |
20
|
10
|
100
|
|
|
|
493
|
unless defined $self->{+INPUT}; |
21
|
|
|
|
|
|
|
|
22
|
9
|
|
|
|
|
45
|
$self->SUPER::init(@_); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub name { |
26
|
7
|
|
|
7
|
1
|
300
|
my $self = shift; |
27
|
7
|
|
|
|
|
16
|
my $in = $self->{+INPUT}; |
28
|
7
|
|
|
|
|
26
|
return "$in"; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub operator { |
32
|
7
|
|
|
7
|
1
|
213
|
my $self = shift; |
33
|
7
|
100
|
|
|
|
30
|
return '!isa' if $self->{+NEGATE}; |
34
|
4
|
|
|
|
|
14
|
return 'isa'; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub verify { |
38
|
33
|
|
|
33
|
1
|
302
|
my $self = shift; |
39
|
33
|
|
|
|
|
90
|
my %params = @_; |
40
|
33
|
|
|
|
|
87
|
my ($got, $exists) = @params{qw/got exists/}; |
41
|
|
|
|
|
|
|
|
42
|
33
|
100
|
|
|
|
86
|
return 0 unless $exists; |
43
|
|
|
|
|
|
|
|
44
|
30
|
|
|
|
|
62
|
my $input = $self->{+INPUT}; |
45
|
30
|
|
|
|
|
56
|
my $negate = $self->{+NEGATE}; |
46
|
30
|
|
100
|
|
|
225
|
my $isa = blessed($got) && $got->isa($input); |
47
|
|
|
|
|
|
|
|
48
|
30
|
100
|
|
|
|
314
|
return !$isa if $negate; |
49
|
21
|
|
|
|
|
93
|
return $isa; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |