line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Kantan::Expect; |
2
|
4
|
|
|
4
|
|
22120
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
235
|
|
3
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
101
|
|
4
|
4
|
|
|
4
|
|
18
|
use utf8; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
23
|
|
5
|
4
|
|
|
4
|
|
182
|
use 5.010_001; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
296
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
1078
|
use Moo; |
|
4
|
|
|
|
|
16108
|
|
|
4
|
|
|
|
|
26
|
|
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
|
|
2658
|
no Moo; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
17
|
|
14
|
|
|
|
|
|
|
|
15
|
4
|
|
|
4
|
|
1988
|
use Try::Tiny; |
|
4
|
|
|
|
|
1542
|
|
|
4
|
|
|
|
|
281
|
|
16
|
|
|
|
|
|
|
|
17
|
4
|
|
|
4
|
|
681
|
use Test::Kantan::Caller; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
180
|
|
18
|
4
|
|
|
4
|
|
3526
|
use Test::Deep::NoTest (); |
|
4
|
|
|
|
|
57169
|
|
|
4
|
|
|
|
|
4103
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _ok { |
21
|
60
|
|
|
60
|
|
236
|
my ($self, %args) = @_; |
22
|
60
|
50
|
|
|
|
656
|
exists($args{value}) or die "Missing value"; |
23
|
60
|
|
|
|
|
154
|
my $value = delete $args{value}; |
24
|
|
|
|
|
|
|
|
25
|
60
|
100
|
|
|
|
575
|
$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
|
74
|
my $self = shift; |
34
|
8
|
|
|
|
|
242
|
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
|
74
|
my $self = shift; |
43
|
|
|
|
|
|
|
|
44
|
4
|
|
|
|
|
53
|
$self->_ok( |
45
|
|
|
|
|
|
|
value => defined($self->stuff), |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub to_be_truthy { |
50
|
6
|
|
|
6
|
1
|
103
|
my ($self) = @_; |
51
|
|
|
|
|
|
|
|
52
|
6
|
|
|
|
|
24
|
$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
|
107
|
my ($self) = @_; |
60
|
|
|
|
|
|
|
|
61
|
6
|
|
|
|
|
27
|
$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
|
37
|
|
|
37
|
1
|
19949
|
my ($self, $expected) = @_; |
69
|
|
|
|
|
|
|
|
70
|
37
|
|
|
|
|
195
|
my ($ok, $stack) = Test::Deep::cmp_details($self->stuff, $expected); |
71
|
37
|
100
|
|
|
|
47384
|
my $diag = $ok ? '-' : Test::Deep::deep_diag($stack); |
72
|
37
|
|
|
|
|
1231
|
$self->_ok( |
73
|
|
|
|
|
|
|
value => $ok, |
74
|
|
|
|
|
|
|
description => $diag, |
75
|
|
|
|
|
|
|
); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
2
|
|
|
2
|
1
|
27
|
sub to_be { goto \&to_equal } |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub to_throw { |
81
|
2
|
|
|
2
|
1
|
17
|
my ($self) = @_; |
82
|
|
|
|
|
|
|
|
83
|
2
|
|
|
|
|
4
|
my $thrown; |
84
|
2
|
|
|
2
|
|
20
|
try { $self->stuff->() } catch { $thrown++ }; |
|
2
|
|
|
|
|
75
|
|
|
1
|
|
|
|
|
23
|
|
85
|
2
|
|
|
|
|
27
|
$self->_ok( |
86
|
|
|
|
|
|
|
value => $thrown, |
87
|
|
|
|
|
|
|
); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub to_match { |
91
|
2
|
|
|
2
|
1
|
44
|
my ($self, $re) = @_; |
92
|
|
|
|
|
|
|
|
93
|
2
|
|
|
|
|
24
|
$self->_ok( |
94
|
|
|
|
|
|
|
value => scalar($self->stuff =~ $re), |
95
|
|
|
|
|
|
|
); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub to_be_a { |
99
|
3
|
|
|
3
|
1
|
32
|
my ($self, $v) = @_; |
100
|
|
|
|
|
|
|
|
101
|
3
|
|
|
|
|
39
|
$self->_ok( |
102
|
|
|
|
|
|
|
value => scalar(UNIVERSAL::isa($self->stuff, $v)), |
103
|
|
|
|
|
|
|
); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
1
|
|
|
1
|
1
|
19
|
sub to_be_an { goto \&to_be_a } |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub to_equal_as_a_bag_of { |
109
|
5
|
|
|
5
|
1
|
61
|
my ($self, $expected) = @_; |
110
|
|
|
|
|
|
|
|
111
|
5
|
|
|
|
|
12
|
$self->to_equal(Test::Deep::bag(@{$expected})); |
|
5
|
|
|
|
|
29
|
|
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
0
|
1
|
0
|
sub to_be_a_bag_of { goto \&to_equal_as_a_bag_of } |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub to_equal_as_a_set_of { |
117
|
5
|
|
|
5
|
1
|
64
|
my ($self, $expected) = @_; |
118
|
|
|
|
|
|
|
|
119
|
5
|
|
|
|
|
10
|
$self->to_equal(Test::Deep::set(@{$expected})); |
|
5
|
|
|
|
|
29
|
|
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
0
|
|
|
0
|
1
|
0
|
sub to_be_a_set_of { goto \&to_equal_as_a_set_of } |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub to_be_a_sub_bag_of { |
125
|
5
|
|
|
5
|
1
|
42
|
my ($self, $expected) = @_; |
126
|
|
|
|
|
|
|
|
127
|
5
|
|
|
|
|
6
|
$self->to_equal(Test::Deep::subbagof(@{$expected})); |
|
5
|
|
|
|
|
19
|
|
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub to_be_a_sub_set_of { |
131
|
4
|
|
|
4
|
1
|
40
|
my ($self, $expected) = @_; |
132
|
|
|
|
|
|
|
|
133
|
4
|
|
|
|
|
6
|
$self->to_equal(Test::Deep::subsetof(@{$expected})); |
|
4
|
|
|
|
|
24
|
|
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub to_be_a_super_bag_of { |
137
|
7
|
|
|
7
|
1
|
61
|
my ($self, $expected) = @_; |
138
|
|
|
|
|
|
|
|
139
|
7
|
|
|
|
|
8
|
$self->to_equal(Test::Deep::superbagof(@{$expected})); |
|
7
|
|
|
|
|
26
|
|
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub to_be_a_super_set_of { |
143
|
1
|
|
|
1
|
1
|
10
|
my ($self, $expected) = @_; |
144
|
|
|
|
|
|
|
|
145
|
1
|
|
|
|
|
2
|
$self->to_equal(Test::Deep::supersetof(@{$expected})); |
|
1
|
|
|
|
|
6
|
|
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub to_be_a_sub_hash_of { |
149
|
3
|
|
|
3
|
1
|
30
|
my ($self, $expected) = @_; |
150
|
|
|
|
|
|
|
|
151
|
3
|
|
|
|
|
13
|
$self->to_equal(Test::Deep::subhashof($expected)); |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub to_be_a_super_hash_of { |
155
|
3
|
|
|
3
|
1
|
28
|
my ($self, $expected) = @_; |
156
|
|
|
|
|
|
|
|
157
|
3
|
|
|
|
|
12
|
$self->to_equal(Test::Deep::superhashof($expected)); |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
1; |
161
|
|
|
|
|
|
|
__END__ |