line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Chai::Core::Assertions::Satisfy; |
2
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
53
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
47
|
|
4
|
2
|
|
|
2
|
|
10
|
use utf8; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
47
|
use Exporter qw/import/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
109
|
|
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw/assert_satisfy/; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
11
|
use Test::Chai::Util::Flag qw/flag/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
109
|
|
10
|
2
|
|
|
2
|
|
11
|
use Test::Chai::Util::ObjDisplay qw/obj_display/; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
346
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub assert_satisfy { |
13
|
2
|
|
|
2
|
0
|
4
|
my ($self, $matcher, $msg) = @_; |
14
|
|
|
|
|
|
|
|
15
|
2
|
50
|
|
|
|
7
|
flag($self, 'message', $msg) if defined $msg; |
16
|
2
|
|
|
|
|
7
|
my $obj = flag($self, 'object'); |
17
|
2
|
|
|
|
|
7
|
my $negate = flag($self, 'negate'); |
18
|
2
|
|
|
|
|
7
|
my $result = $matcher->($obj); |
19
|
|
|
|
|
|
|
|
20
|
2
|
50
|
|
|
|
13
|
return $self->assert( |
21
|
|
|
|
|
|
|
$result, |
22
|
|
|
|
|
|
|
'expected #{this} to satisfy ' . obj_display($matcher), |
23
|
|
|
|
|
|
|
'expected #{this} to not satisfy' . obj_display($matcher), |
24
|
|
|
|
|
|
|
$negate ? 0 : 1, |
25
|
|
|
|
|
|
|
$result |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |