line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Kantan::Expect; |
2
|
4
|
|
|
4
|
|
29183
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
137
|
|
3
|
4
|
|
|
4
|
|
22
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
102
|
|
4
|
4
|
|
|
4
|
|
21
|
use utf8; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
24
|
|
5
|
4
|
|
|
4
|
|
164
|
use 5.010_001; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
250
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
1328
|
use Moo; |
|
4
|
|
|
|
|
25225
|
|
|
4
|
|
|
|
|
24
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has builder => ( is => 'rw', required => 1 ); |
10
|
|
|
|
|
|
|
has stuff => ( is => 'rw', required => 1 ); |
11
|
|
|
|
|
|
|
has inverted => ( is => 'rw', default => sub { 0 } ); |
12
|
|
|
|
|
|
|
|
13
|
4
|
|
|
4
|
|
3152
|
no Moo; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
18
|
|
14
|
|
|
|
|
|
|
|
15
|
4
|
|
|
4
|
|
1973
|
use Try::Tiny; |
|
4
|
|
|
|
|
1725
|
|
|
4
|
|
|
|
|
295
|
|
16
|
|
|
|
|
|
|
|
17
|
4
|
|
|
4
|
|
561
|
use Test::Kantan::Caller; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
120
|
|
18
|
4
|
|
|
4
|
|
3332
|
use Test::Deep::NoTest (); |
|
4
|
|
|
|
|
49303
|
|
|
4
|
|
|
|
|
2594
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _ok { |
21
|
27
|
|
|
27
|
|
93
|
my ($self, %args) = @_; |
22
|
27
|
50
|
|
|
|
89
|
exists($args{value}) or die "Missing value"; |
23
|
27
|
|
|
|
|
65
|
my $value = delete $args{value}; |
24
|
|
|
|
|
|
|
|
25
|
27
|
100
|
|
|
|
169
|
$self->builder->ok( |
26
|
|
|
|
|
|
|
caller => Test::Kantan::Caller->new(1), |
27
|
|
|
|
|
|
|
value => $self->inverted ? !$value : $value, |
28
|
|
|
|
|
|
|
%args, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub not { |
33
|
8
|
|
|
8
|
0
|
67
|
my $self = shift; |
34
|
8
|
|
|
|
|
247
|
Test::Kantan::Expect->new( |
35
|
|
|
|
|
|
|
builder => $self->builder, |
36
|
|
|
|
|
|
|
stuff => $self->stuff, |
37
|
|
|
|
|
|
|
inverted => !$self->inverted, |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub to_be_defined { |
42
|
4
|
|
|
4
|
1
|
72
|
my $self = shift; |
43
|
|
|
|
|
|
|
|
44
|
4
|
|
|
|
|
28
|
$self->_ok( |
45
|
|
|
|
|
|
|
value => defined($self->stuff), |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub to_be_truthy { |
50
|
6
|
|
|
6
|
1
|
98
|
my ($self) = @_; |
51
|
|
|
|
|
|
|
|
52
|
6
|
|
|
|
|
28
|
$self->_ok( |
53
|
|
|
|
|
|
|
value => $self->stuff, |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
} |
56
|
0
|
|
|
0
|
1
|
0
|
sub to_be_true { goto \&to_be_truthy } |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub to_be_falsy { |
59
|
6
|
|
|
6
|
1
|
99
|
my ($self) = @_; |
60
|
|
|
|
|
|
|
|
61
|
6
|
|
|
|
|
26
|
$self->_ok( |
62
|
|
|
|
|
|
|
value => !$self->stuff, |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
} |
65
|
0
|
|
|
0
|
1
|
0
|
sub to_be_false { goto \&to_be_falsy } |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub to_equal { |
68
|
4
|
|
|
4
|
1
|
25
|
my ($self, $expected) = @_; |
69
|
|
|
|
|
|
|
|
70
|
4
|
|
|
|
|
34
|
my ($ok, $stack) = Test::Deep::cmp_details($self->stuff, $expected); |
71
|
4
|
100
|
|
|
|
4006
|
my $diag = $ok ? '-' : Test::Deep::deep_diag($stack); |
72
|
4
|
|
|
|
|
161
|
$self->_ok( |
73
|
|
|
|
|
|
|
value => $ok, |
74
|
|
|
|
|
|
|
description => $diag, |
75
|
|
|
|
|
|
|
); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
2
|
|
|
2
|
1
|
18
|
sub to_be { goto \&to_equal } |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub to_throw { |
81
|
2
|
|
|
2
|
1
|
23
|
my ($self) = @_; |
82
|
|
|
|
|
|
|
|
83
|
2
|
|
|
|
|
3
|
my $thrown; |
84
|
2
|
|
|
1
|
|
20
|
try { $self->stuff->() } catch { $thrown++ }; |
|
2
|
|
|
|
|
85
|
|
|
1
|
|
|
|
|
25
|
|
85
|
2
|
|
|
|
|
35
|
$self->_ok( |
86
|
|
|
|
|
|
|
value => $thrown, |
87
|
|
|
|
|
|
|
); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub to_match { |
91
|
2
|
|
|
2
|
1
|
27
|
my ($self, $re) = @_; |
92
|
|
|
|
|
|
|
|
93
|
2
|
|
|
|
|
17
|
$self->_ok( |
94
|
|
|
|
|
|
|
value => scalar($self->stuff =~ $re), |
95
|
|
|
|
|
|
|
); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub to_be_a { |
99
|
3
|
|
|
3
|
1
|
20
|
my ($self, $v) = @_; |
100
|
|
|
|
|
|
|
|
101
|
3
|
|
|
|
|
26
|
$self->_ok( |
102
|
|
|
|
|
|
|
value => scalar(UNIVERSAL::isa($self->stuff, $v)), |
103
|
|
|
|
|
|
|
); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
1
|
|
|
1
|
1
|
25
|
sub to_be_an { goto \&to_be_a } |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1; |
109
|
|
|
|
|
|
|
__END__ |