| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Chai::Core::Assertions::Exist; |
|
2
|
2
|
|
|
2
|
|
10
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
52
|
|
|
3
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
48
|
|
|
4
|
2
|
|
|
2
|
|
9
|
use utf8; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
59
|
use Exporter qw/import/; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
112
|
|
|
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw/ |
|
8
|
|
|
|
|
|
|
assert_ok |
|
9
|
|
|
|
|
|
|
assert_exist |
|
10
|
|
|
|
|
|
|
assert_undef |
|
11
|
|
|
|
|
|
|
/; |
|
12
|
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
10
|
use Test::Chai::Util::Flag qw/flag/; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
403
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub assert_ok { |
|
16
|
4
|
|
|
4
|
0
|
7
|
my $self = shift; |
|
17
|
4
|
|
|
|
|
12
|
my $obj = flag($self, 'object'); |
|
18
|
4
|
|
|
|
|
15
|
return $self->assert( |
|
19
|
|
|
|
|
|
|
$obj, |
|
20
|
|
|
|
|
|
|
'expected #{this} to be truthy', |
|
21
|
|
|
|
|
|
|
'expected #{this} to be falsy' |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub assert_exist { |
|
26
|
2
|
|
|
2
|
0
|
5
|
my $self = shift; |
|
27
|
2
|
|
|
|
|
6
|
return $self->assert( |
|
28
|
|
|
|
|
|
|
defined flag($self, 'object'), |
|
29
|
|
|
|
|
|
|
'expected #{this} to exist', |
|
30
|
|
|
|
|
|
|
'expected #{this} to not exist' |
|
31
|
|
|
|
|
|
|
); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub assert_undef { |
|
35
|
6
|
|
|
6
|
0
|
9
|
my $self = shift; |
|
36
|
6
|
|
|
|
|
17
|
return $self->assert( |
|
37
|
|
|
|
|
|
|
!defined flag($self, 'object'), |
|
38
|
|
|
|
|
|
|
'expected #{this} to be undef', |
|
39
|
|
|
|
|
|
|
'expected #{this} not to be undef' |
|
40
|
|
|
|
|
|
|
); |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |