line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Chai::Core::Assertions; |
2
|
2
|
|
|
2
|
|
1196
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
51
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1105
|
|
4
|
2
|
|
|
2
|
|
18
|
use utf8; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
12
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
55
|
use Scalar::Util qw/looks_like_number/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
192
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
12
|
use Test::Chai::Assertion; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
13
|
|
9
|
2
|
|
|
2
|
|
234
|
use Test::Chai::Util::Flag qw/flag/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
605
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub Assertion () { 'Test::Chai::Assertion' } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------------- |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
do { |
16
|
|
|
|
|
|
|
Assertion->add_property($_, sub { shift }) |
17
|
|
|
|
|
|
|
} for qw/ |
18
|
|
|
|
|
|
|
to be been |
19
|
|
|
|
|
|
|
is and has have |
20
|
|
|
|
|
|
|
with that which at |
21
|
|
|
|
|
|
|
of same |
22
|
|
|
|
|
|
|
/; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------------- |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Assertion->add_property('not', sub { |
27
|
|
|
|
|
|
|
flag(shift, 'negate', 1); |
28
|
|
|
|
|
|
|
}); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Assertion->add_property('deep', sub { |
31
|
|
|
|
|
|
|
flag(shift, 'deep', 1); |
32
|
|
|
|
|
|
|
}); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Assertion->add_property('any', sub { |
35
|
|
|
|
|
|
|
flag(shift, 'any', 1); |
36
|
|
|
|
|
|
|
flag(shift, 'all', 0); |
37
|
|
|
|
|
|
|
}); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Assertion->add_property('all', sub { |
40
|
|
|
|
|
|
|
flag(shift, 'all', 0); |
41
|
|
|
|
|
|
|
flag(shift, 'any', 1); |
42
|
|
|
|
|
|
|
}); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Assertion->add_property('itself', sub { |
45
|
|
|
|
|
|
|
flag(shift, 'itself', 1); |
46
|
|
|
|
|
|
|
}); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------------- |
49
|
|
|
|
|
|
|
|
50
|
2
|
|
|
2
|
|
929
|
use Test::Chai::Core::Assertions::An qw/assert_an/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
197
|
|
51
|
|
|
|
|
|
|
Assertion->add_chainable_method('an', \&assert_an); |
52
|
|
|
|
|
|
|
Assertion->add_chainable_method('a', \&assert_an); |
53
|
|
|
|
|
|
|
|
54
|
2
|
|
|
|
|
388
|
use Test::Chai::Core::Assertions::Include qw/ |
55
|
|
|
|
|
|
|
assert_include |
56
|
|
|
|
|
|
|
assert_include_chaining_behavior |
57
|
2
|
|
|
2
|
|
993
|
/; |
|
2
|
|
|
|
|
6
|
|
58
|
|
|
|
|
|
|
Assertion->add_chainable_method('include', \&assert_include, \&assert_include_chaining_behavior); |
59
|
|
|
|
|
|
|
Assertion->add_chainable_method('includes', \&assert_include, \&assert_include_chaining_behavior); |
60
|
|
|
|
|
|
|
Assertion->add_chainable_method('contain', \&assert_include, \&assert_include_chaining_behavior); |
61
|
|
|
|
|
|
|
Assertion->add_chainable_method('contains', \&assert_include, \&assert_include_chaining_behavior); |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
206
|
use Test::Chai::Core::Assertions::Bool qw/ |
64
|
|
|
|
|
|
|
assert_true |
65
|
|
|
|
|
|
|
assert_false |
66
|
2
|
|
|
2
|
|
943
|
/; |
|
2
|
|
|
|
|
6
|
|
67
|
|
|
|
|
|
|
Assertion->add_property('true', \&assert_true); |
68
|
|
|
|
|
|
|
Assertion->add_property('false', \&assert_false); |
69
|
|
|
|
|
|
|
|
70
|
2
|
|
|
|
|
295
|
use Test::Chai::Core::Assertions::Exist qw/ |
71
|
|
|
|
|
|
|
assert_ok |
72
|
|
|
|
|
|
|
assert_exist |
73
|
|
|
|
|
|
|
assert_undef |
74
|
2
|
|
|
2
|
|
970
|
/; |
|
2
|
|
|
|
|
6
|
|
75
|
|
|
|
|
|
|
Assertion->add_property('ok', \&assert_ok); |
76
|
|
|
|
|
|
|
Assertion->add_property('exist', \&assert_exist); |
77
|
|
|
|
|
|
|
Assertion->add_property('undef', \&assert_undef); |
78
|
|
|
|
|
|
|
Assertion->add_property('undefined', \&assert_undef); |
79
|
|
|
|
|
|
|
|
80
|
2
|
|
|
2
|
|
944
|
use Test::Chai::Core::Assertions::Nan qw/assert_nan/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
147
|
|
81
|
|
|
|
|
|
|
Assertion->add_property('NaN', \&assert_nan); |
82
|
|
|
|
|
|
|
|
83
|
2
|
|
|
2
|
|
945
|
use Test::Chai::Core::Assertions::Empty qw/assert_empty/; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
147
|
|
84
|
|
|
|
|
|
|
Assertion->add_property('empty', \&assert_empty); |
85
|
|
|
|
|
|
|
|
86
|
2
|
|
|
2
|
|
898
|
use Test::Chai::Core::Assertions::Equal qw/assert_equal/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
204
|
|
87
|
|
|
|
|
|
|
Assertion->add_method('equal', \&assert_equal); |
88
|
|
|
|
|
|
|
Assertion->add_method('equals', \&assert_equal); |
89
|
|
|
|
|
|
|
Assertion->add_method('eq', \&assert_equal); |
90
|
|
|
|
|
|
|
|
91
|
2
|
|
|
2
|
|
885
|
use Test::Chai::Core::Assertions::Eql qw/assert_eql/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
182
|
|
92
|
|
|
|
|
|
|
Assertion->add_method('eql', \&assert_eql); |
93
|
|
|
|
|
|
|
Assertion->add_method('eqls', \&assert_eql); |
94
|
|
|
|
|
|
|
|
95
|
2
|
|
|
2
|
|
916
|
use Test::Chai::Core::Assertions::Above qw/assert_above/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
203
|
|
96
|
|
|
|
|
|
|
Assertion->add_method('above', \&assert_above); |
97
|
|
|
|
|
|
|
Assertion->add_method('gt', \&assert_above); |
98
|
|
|
|
|
|
|
Assertion->add_method('greater_than', \&assert_above); |
99
|
|
|
|
|
|
|
|
100
|
2
|
|
|
2
|
|
896
|
use Test::Chai::Core::Assertions::Least qw/assert_least/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
237
|
|
101
|
|
|
|
|
|
|
Assertion->add_method('least', \&assert_least); |
102
|
|
|
|
|
|
|
Assertion->add_method('gte', \&assert_least); |
103
|
|
|
|
|
|
|
|
104
|
2
|
|
|
2
|
|
891
|
use Test::Chai::Core::Assertions::Below qw/assert_below/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
245
|
|
105
|
|
|
|
|
|
|
Assertion->add_method('below', \&assert_below); |
106
|
|
|
|
|
|
|
Assertion->add_method('lt', \&assert_below); |
107
|
|
|
|
|
|
|
Assertion->add_method('less_than', \&assert_below); |
108
|
|
|
|
|
|
|
|
109
|
2
|
|
|
2
|
|
1029
|
use Test::Chai::Core::Assertions::Most qw/assert_most/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
172
|
|
110
|
|
|
|
|
|
|
Assertion->add_method('most', \&assert_most); |
111
|
|
|
|
|
|
|
Assertion->add_method('lte', \&assert_most); |
112
|
|
|
|
|
|
|
|
113
|
2
|
|
|
2
|
|
958
|
use Test::Chai::Core::Assertions::Within qw/assert_within/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
151
|
|
114
|
|
|
|
|
|
|
Assertion->add_method('within', \&assert_within); |
115
|
|
|
|
|
|
|
|
116
|
2
|
|
|
2
|
|
910
|
use Test::Chai::Core::Assertions::InstanceOf qw/assert_instance_of/; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
178
|
|
117
|
|
|
|
|
|
|
Assertion->add_method('instanceof', \&assert_instance_of); |
118
|
|
|
|
|
|
|
Assertion->add_method('instance_of', \&assert_instance_of); |
119
|
|
|
|
|
|
|
|
120
|
2
|
|
|
2
|
|
998
|
use Test::Chai::Core::Assertions::Property qw/assert_property/; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
161
|
|
121
|
|
|
|
|
|
|
Assertion->add_method('property', \&assert_property); |
122
|
|
|
|
|
|
|
|
123
|
2
|
|
|
|
|
210
|
use Test::Chai::Core::Assertions::Length qw/ |
124
|
|
|
|
|
|
|
assert_length |
125
|
|
|
|
|
|
|
assert_length_chain |
126
|
2
|
|
|
2
|
|
926
|
/; |
|
2
|
|
|
|
|
5
|
|
127
|
|
|
|
|
|
|
Assertion->add_method('length_of', \&assert_length); |
128
|
|
|
|
|
|
|
Assertion->add_chainable_method('length', \&assert_length, \&assert_length_chain); |
129
|
|
|
|
|
|
|
|
130
|
2
|
|
|
2
|
|
907
|
use Test::Chai::Core::Assertions::Match qw/assert_match/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
223
|
|
131
|
|
|
|
|
|
|
Assertion->add_method('match', \&assert_match); |
132
|
|
|
|
|
|
|
Assertion->add_method('matches', \&assert_match); |
133
|
|
|
|
|
|
|
|
134
|
2
|
|
|
2
|
|
947
|
use Test::Chai::Core::Assertions::String qw/assert_string/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1193
|
|
135
|
|
|
|
|
|
|
Assertion->add_method('string', \&assert_string); |
136
|
|
|
|
|
|
|
|
137
|
2
|
|
|
2
|
|
988
|
use Test::Chai::Core::Assertions::Keys qw/assert_keys/; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
187
|
|
138
|
|
|
|
|
|
|
Assertion->add_method('keys', \&assert_keys); |
139
|
|
|
|
|
|
|
Assertion->add_method('key', \&assert_keys); |
140
|
|
|
|
|
|
|
|
141
|
2
|
|
|
2
|
|
995
|
use Test::Chai::Core::Assertions::Exception qw/assert_throw/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
215
|
|
142
|
|
|
|
|
|
|
Assertion->add_method('throw', \&assert_throw); |
143
|
|
|
|
|
|
|
Assertion->add_method('Throw', \&assert_throw); |
144
|
|
|
|
|
|
|
Assertion->add_method('throws', \&assert_throw); |
145
|
|
|
|
|
|
|
|
146
|
2
|
|
|
2
|
|
1009
|
use Test::Chai::Core::Assertions::RespondTo qw/assert_respond_to/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
233
|
|
147
|
|
|
|
|
|
|
Assertion->add_method('respond_to', \&assert_respond_to); |
148
|
|
|
|
|
|
|
Assertion->add_method('responds_to', \&assert_respond_to); |
149
|
|
|
|
|
|
|
|
150
|
2
|
|
|
2
|
|
946
|
use Test::Chai::Core::Assertions::Satisfy qw/assert_satisfy/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
180
|
|
151
|
|
|
|
|
|
|
Assertion->add_method('satisfy', \&assert_satisfy); |
152
|
|
|
|
|
|
|
Assertion->add_method('satisfies', \&assert_satisfy); |
153
|
|
|
|
|
|
|
|
154
|
2
|
|
|
2
|
|
987
|
use Test::Chai::Core::Assertions::CloseTo qw/assert_close_to/; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
157
|
|
155
|
|
|
|
|
|
|
Assertion->add_method('close_to', \&assert_close_to); |
156
|
|
|
|
|
|
|
|
157
|
2
|
|
|
2
|
|
1028
|
use Test::Chai::Core::Assertions::Member qw/assert_member/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
158
|
|
158
|
|
|
|
|
|
|
Assertion->add_method('members', \&assert_member); |
159
|
|
|
|
|
|
|
|
160
|
2
|
|
|
2
|
|
911
|
use Test::Chai::Core::Assertions::Change qw/assert_change/; |
|
2
|
|
|
|
|
132
|
|
|
2
|
|
|
|
|
185
|
|
161
|
|
|
|
|
|
|
Assertion->add_method('change', \&assert_change); |
162
|
|
|
|
|
|
|
Assertion->add_method('changes', \&assert_change); |
163
|
|
|
|
|
|
|
|
164
|
2
|
|
|
2
|
|
905
|
use Test::Chai::Core::Assertions::Increase qw/assert_increase/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
210
|
|
165
|
|
|
|
|
|
|
Assertion->add_chainable_method('increase', \&assert_increase); |
166
|
|
|
|
|
|
|
Assertion->add_chainable_method('increases', \&assert_increase); |
167
|
|
|
|
|
|
|
|
168
|
2
|
|
|
2
|
|
913
|
use Test::Chai::Core::Assertions::Decrease qw/assert_decrease/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
329
|
|
169
|
|
|
|
|
|
|
Assertion->add_chainable_method('decrease', \&assert_decrease); |
170
|
|
|
|
|
|
|
Assertion->add_chainable_method('decreases', \&assert_decrease); |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
1; |