line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Chai::Core::Assertions::InstanceOf; |
2
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
60
|
|
3
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
59
|
|
4
|
2
|
|
|
2
|
|
10
|
use utf8; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
56
|
use Exporter qw/import/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
115
|
|
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw/assert_instance_of/; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
10
|
use Scalar::Util qw/blessed/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
109
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
10
|
use Test::Chai::Util::Flag qw/flag/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
308
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub assert_instance_of { |
14
|
2
|
|
|
2
|
0
|
5
|
my ($self, $type, $msg) = @_; |
15
|
|
|
|
|
|
|
|
16
|
2
|
50
|
|
|
|
5
|
flag($self, 'message', $msg) if defined $msg; |
17
|
2
|
|
|
|
|
7
|
my $obj = flag($self, 'object'); |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
66
|
|
|
19
|
return $self->assert( |
20
|
|
|
|
|
|
|
blessed($obj) && $obj->isa($type), |
21
|
|
|
|
|
|
|
'expected #{this} to be an instance of ' . $type, |
22
|
|
|
|
|
|
|
'expected #{this} to not be an instance of ' . $type |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |