line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
511
|
use 5.006; |
|
6
|
|
|
|
|
18
|
|
4
|
6
|
|
|
6
|
|
25
|
use strict; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
137
|
|
5
|
6
|
|
|
6
|
|
23
|
use warnings; |
|
6
|
|
|
|
|
26
|
|
|
6
|
|
|
|
|
575
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#---- perlcritic exemptions. ----# |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# We use a lot of subroutine prototypes |
10
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitSubroutinePrototypes) |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Can't use Carp because it might cause C<use_ok()> to accidentally succeed |
13
|
|
|
|
|
|
|
# even though the module being used forgot to use Carp. Yes, this |
14
|
|
|
|
|
|
|
# actually happened. |
15
|
|
|
|
|
|
|
my( $file, $line ) = ( caller(1) )[ 1, 2 ]; |
16
|
0
|
|
|
0
|
|
0
|
return warn @_, " at $file line $line\n"; |
17
|
0
|
|
|
|
|
0
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '1.302170'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use Test::Builder::Module; |
22
|
6
|
|
|
6
|
|
2136
|
our @ISA = qw(Test::Builder::Module); |
|
6
|
|
|
|
|
55
|
|
|
6
|
|
|
|
|
40
|
|
23
|
|
|
|
|
|
|
our @EXPORT = qw(ok use_ok require_ok |
24
|
|
|
|
|
|
|
is isnt like unlike is_deeply |
25
|
|
|
|
|
|
|
cmp_ok |
26
|
|
|
|
|
|
|
skip todo todo_skip |
27
|
|
|
|
|
|
|
pass fail |
28
|
|
|
|
|
|
|
eq_array eq_hash eq_set |
29
|
|
|
|
|
|
|
$TODO |
30
|
|
|
|
|
|
|
plan |
31
|
|
|
|
|
|
|
done_testing |
32
|
|
|
|
|
|
|
can_ok isa_ok new_ok |
33
|
|
|
|
|
|
|
diag note explain |
34
|
|
|
|
|
|
|
subtest |
35
|
|
|
|
|
|
|
BAIL_OUT |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#line 166 |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
return $tb->plan(@_); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# This implements "use Test::More 'no_diag'" but the behavior is |
46
|
|
|
|
|
|
|
# deprecated. |
47
|
|
|
|
|
|
|
my $class = shift; |
48
|
|
|
|
|
|
|
my $list = shift; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my @other = (); |
51
|
|
|
|
|
|
|
my $idx = 0; |
52
|
|
|
|
|
|
|
my $import; |
53
|
|
|
|
|
|
|
while( $idx <= $#{$list} ) { |
54
|
|
|
|
|
|
|
my $item = $list->[$idx]; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
if( defined $item and $item eq 'no_diag' ) { |
57
|
|
|
|
|
|
|
$class->builder->no_diag(1); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
elsif( defined $item and $item eq 'import' ) { |
60
|
|
|
|
|
|
|
if ($import) { |
61
|
|
|
|
|
|
|
push @$import, @{$list->[ ++$idx ]}; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
else { |
64
|
|
|
|
|
|
|
$import = $list->[ ++$idx ]; |
65
|
|
|
|
|
|
|
push @other, $item, $import; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
else { |
69
|
|
|
|
|
|
|
push @other, $item; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
$idx++; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
@$list = @other; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
if ($class eq __PACKAGE__ && (!$import || grep $_ eq '$TODO', @$import)) { |
78
|
|
|
|
|
|
|
my $to = $class->builder->exported_to; |
79
|
|
|
|
|
|
|
no strict 'refs'; |
80
|
|
|
|
|
|
|
*{"$to\::TODO"} = \our $TODO; |
81
|
|
|
|
|
|
|
if ($import) { |
82
|
|
|
|
|
|
|
@$import = grep $_ ne '$TODO', @$import; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
else { |
85
|
|
|
|
|
|
|
push @$list, import => [grep $_ ne '$TODO', @EXPORT]; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
return; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
#line 245 |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
95
|
|
|
|
|
|
|
$tb->done_testing(@_); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
#line 317 |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
my( $test, $name ) = @_; |
101
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
return $tb->ok( $test, $name ); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
#line 400 |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
return $tb->is_eq(@_); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
return $tb->isnt_eq(@_); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
*isn't = \&isnt; |
119
|
|
|
|
|
|
|
# ' to unconfuse syntax higlighters |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
#line 445 |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
return $tb->like(@_); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
#line 460 |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
return $tb->unlike(@_); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
#line 506 |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
return $tb->cmp_ok(@_); |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
#line 541 |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
my( $proto, @methods ) = @_; |
145
|
|
|
|
|
|
|
my $class = ref $proto || $proto; |
146
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
unless($class) { |
149
|
|
|
|
|
|
|
my $ok = $tb->ok( 0, "->can(...)" ); |
150
|
|
|
|
|
|
|
$tb->diag(' can_ok() called with empty class or reference'); |
151
|
|
|
|
|
|
|
return $ok; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
unless(@methods) { |
155
|
|
|
|
|
|
|
my $ok = $tb->ok( 0, "$class->can(...)" ); |
156
|
|
|
|
|
|
|
$tb->diag(' can_ok() called with no methods'); |
157
|
|
|
|
|
|
|
return $ok; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
my @nok = (); |
161
|
|
|
|
|
|
|
foreach my $method (@methods) { |
162
|
|
|
|
|
|
|
$tb->_try( sub { $proto->can($method) } ) or push @nok, $method; |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
my $name = (@methods == 1) ? "$class->can('$methods[0]')" : |
166
|
|
|
|
|
|
|
"$class->can(...)" ; |
167
|
|
|
|
|
|
|
|
168
|
5
|
|
|
5
|
1
|
200
|
my $ok = $tb->ok( !@nok, $name ); |
169
|
|
|
|
|
|
|
|
170
|
5
|
|
|
|
|
40
|
$tb->diag( map " $class->can('$_') failed\n", @nok ); |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
return $ok; |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
#line 607 |
176
|
6
|
|
|
6
|
1
|
37
|
|
177
|
6
|
|
|
|
|
13
|
my( $thing, $class, $thing_name ) = @_; |
178
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
179
|
6
|
|
|
|
|
11
|
|
180
|
6
|
|
|
|
|
11
|
my $whatami; |
181
|
6
|
|
|
|
|
9
|
if( !defined $thing ) { |
182
|
6
|
|
|
|
|
14
|
$whatami = 'undef'; |
|
13
|
|
|
|
|
34
|
|
183
|
7
|
|
|
|
|
18
|
} |
184
|
|
|
|
|
|
|
elsif( ref $thing ) { |
185
|
7
|
50
|
33
|
|
|
74
|
$whatami = 'reference'; |
|
|
100
|
66
|
|
|
|
|
186
|
0
|
|
|
|
|
0
|
|
187
|
|
|
|
|
|
|
local($@,$!); |
188
|
|
|
|
|
|
|
require Scalar::Util; |
189
|
5
|
50
|
|
|
|
16
|
if( Scalar::Util::blessed($thing) ) { |
190
|
0
|
|
|
|
|
0
|
$whatami = 'object'; |
|
0
|
|
|
|
|
0
|
|
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
} |
193
|
5
|
|
|
|
|
10
|
else { |
194
|
5
|
|
|
|
|
15
|
$whatami = 'class'; |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
# We can't use UNIVERSAL::isa because we want to honor isa() overrides |
198
|
2
|
|
|
|
|
3
|
my( $rslt, $error ) = $tb->_try( sub { $thing->isa($class) } ); |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
if($error) { |
201
|
7
|
|
|
|
|
14
|
die <<WHOA unless $error =~ /^Can't (locate|call) method "isa"/; |
202
|
|
|
|
|
|
|
WHOA! I tried to call ->isa on your $whatami and got some weird error. |
203
|
|
|
|
|
|
|
Here's the error. |
204
|
6
|
|
|
|
|
19
|
$error |
205
|
|
|
|
|
|
|
WHOA |
206
|
6
|
50
|
66
|
|
|
63
|
} |
|
|
|
66
|
|
|
|
|
207
|
6
|
|
|
|
|
20
|
|
208
|
6
|
|
|
6
|
|
46
|
# Special case for isa_ok( [], "ARRAY" ) and like |
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
16767
|
|
209
|
6
|
|
|
|
|
15
|
if( $whatami eq 'reference' ) { |
|
6
|
|
|
|
|
38
|
|
210
|
6
|
100
|
|
|
|
25
|
$rslt = UNIVERSAL::isa($thing, $class); |
211
|
5
|
|
|
|
|
38
|
} |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
my($diag, $name); |
214
|
1
|
|
|
|
|
8
|
if( defined $thing_name ) { |
215
|
|
|
|
|
|
|
$name = "'$thing_name' isa '$class'"; |
216
|
|
|
|
|
|
|
$diag = defined $thing ? "'$thing_name' isn't a '$class'" : "'$thing_name' isn't defined"; |
217
|
|
|
|
|
|
|
} |
218
|
6
|
|
|
|
|
19
|
elsif( $whatami eq 'object' ) { |
219
|
|
|
|
|
|
|
my $my_class = ref $thing; |
220
|
|
|
|
|
|
|
$thing_name = qq[An object of class '$my_class']; |
221
|
|
|
|
|
|
|
$name = "$thing_name isa '$class'"; |
222
|
|
|
|
|
|
|
$diag = "The object of class '$my_class' isn't a '$class'"; |
223
|
|
|
|
|
|
|
} |
224
|
|
|
|
|
|
|
elsif( $whatami eq 'reference' ) { |
225
|
|
|
|
|
|
|
my $type = ref $thing; |
226
|
|
|
|
|
|
|
$thing_name = qq[A reference of type '$type']; |
227
|
|
|
|
|
|
|
$name = "$thing_name isa '$class'"; |
228
|
|
|
|
|
|
|
$diag = "The reference of type '$type' isn't a '$class'"; |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
elsif( $whatami eq 'undef' ) { |
231
|
|
|
|
|
|
|
$thing_name = 'undef'; |
232
|
|
|
|
|
|
|
$name = "$thing_name isa '$class'"; |
233
|
|
|
|
|
|
|
$diag = "$thing_name isn't defined"; |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
elsif( $whatami eq 'class' ) { |
236
|
|
|
|
|
|
|
$thing_name = qq[The class (or class-like) '$thing']; |
237
|
|
|
|
|
|
|
$name = "$thing_name isa '$class'"; |
238
|
|
|
|
|
|
|
$diag = "$thing_name isn't a '$class'"; |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
else { |
241
|
|
|
|
|
|
|
die; |
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
my $ok; |
245
|
|
|
|
|
|
|
if($rslt) { |
246
|
|
|
|
|
|
|
$ok = $tb->ok( 1, $name ); |
247
|
0
|
|
|
0
|
1
|
0
|
} |
248
|
0
|
|
|
|
|
0
|
else { |
249
|
|
|
|
|
|
|
$ok = $tb->ok( 0, $name ); |
250
|
|
|
|
|
|
|
$tb->diag(" $diag\n"); |
251
|
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
return $ok; |
254
|
|
|
|
|
|
|
} |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
#line 708 |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
259
|
|
|
|
|
|
|
$tb->croak("new_ok() must be given at least a class") unless @_; |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
my( $class, $args, $object_name ) = @_; |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
$args ||= []; |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
my $obj; |
266
|
|
|
|
|
|
|
my( $success, $error ) = $tb->_try( sub { $obj = $class->new(@$args); 1 } ); |
267
|
|
|
|
|
|
|
if($success) { |
268
|
|
|
|
|
|
|
local $Test::Builder::Level = $Test::Builder::Level + 1; |
269
|
|
|
|
|
|
|
isa_ok $obj, $class, $object_name; |
270
|
|
|
|
|
|
|
} |
271
|
|
|
|
|
|
|
else { |
272
|
|
|
|
|
|
|
$class = 'undef' if !defined $class; |
273
|
|
|
|
|
|
|
$tb->ok( 0, "$class->new() died" ); |
274
|
|
|
|
|
|
|
$tb->diag(" Error was: $error"); |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
return $obj; |
278
|
|
|
|
|
|
|
} |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
#line 805 |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
283
|
|
|
|
|
|
|
return $tb->subtest(@_); |
284
|
|
|
|
|
|
|
} |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
#line 827 |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
return $tb->ok( 1, @_ ); |
291
|
|
|
|
|
|
|
} |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
return $tb->ok( 0, @_ ); |
296
|
|
|
|
|
|
|
} |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
#line 880 |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
my($module) = shift; |
301
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
my $pack = caller; |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
# Try to determine if we've been given a module name or file. |
306
|
|
|
|
|
|
|
# Module names must be barewords, files not. |
307
|
|
|
|
|
|
|
$module = qq['$module'] unless _is_module_name($module); |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
my $code = <<REQUIRE; |
310
|
|
|
|
|
|
|
package $pack; |
311
|
|
|
|
|
|
|
require $module; |
312
|
|
|
|
|
|
|
1; |
313
|
|
|
|
|
|
|
REQUIRE |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
my( $eval_result, $eval_error ) = _eval($code); |
316
|
|
|
|
|
|
|
my $ok = $tb->ok( $eval_result, "require $module;" ); |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
unless($ok) { |
319
|
0
|
|
|
0
|
1
|
0
|
chomp $eval_error; |
320
|
0
|
|
|
|
|
0
|
$tb->diag(<<DIAGNOSTIC); |
321
|
|
|
|
|
|
|
Tried to require '$module'. |
322
|
0
|
|
|
|
|
0
|
Error: $eval_error |
323
|
|
|
|
|
|
|
DIAGNOSTIC |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
} |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
return $ok; |
328
|
|
|
|
|
|
|
} |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
my $module = shift; |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
# Module names start with a letter. |
333
|
|
|
|
|
|
|
# End with an alphanumeric. |
334
|
|
|
|
|
|
|
# The rest is an alphanumeric or :: |
335
|
|
|
|
|
|
|
$module =~ s/\b::\b//g; |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
return $module =~ /^[a-zA-Z]\w*$/ ? 1 : 0; |
338
|
|
|
|
|
|
|
} |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
#line 974 |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
my( $module, @imports ) = @_; |
344
|
|
|
|
|
|
|
@imports = () unless @imports; |
345
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
my %caller; |
348
|
|
|
|
|
|
|
@caller{qw/pack file line sub args want eval req strict warn/} = caller(0); |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
my ($pack, $filename, $line, $warn) = @caller{qw/pack file line warn/}; |
351
|
|
|
|
|
|
|
$filename =~ y/\n\r/_/; # so it doesn't run off the "#line $line $f" line |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
my $code; |
354
|
|
|
|
|
|
|
if( @imports == 1 and $imports[0] =~ /^\d+(?:\.\d+)?$/ ) { |
355
|
|
|
|
|
|
|
# probably a version check. Perl needs to see the bare number |
356
|
|
|
|
|
|
|
# for it to work with non-Exporter based modules. |
357
|
|
|
|
|
|
|
$code = <<USE; |
358
|
|
|
|
|
|
|
package $pack; |
359
|
|
|
|
|
|
|
BEGIN { \${^WARNING_BITS} = \$args[-1] if defined \$args[-1] } |
360
|
|
|
|
|
|
|
#line $line $filename |
361
|
|
|
|
|
|
|
use $module $imports[0]; |
362
|
|
|
|
|
|
|
1; |
363
|
|
|
|
|
|
|
USE |
364
|
|
|
|
|
|
|
} |
365
|
|
|
|
|
|
|
else { |
366
|
|
|
|
|
|
|
$code = <<USE; |
367
|
|
|
|
|
|
|
package $pack; |
368
|
|
|
|
|
|
|
BEGIN { \${^WARNING_BITS} = \$args[-1] if defined \$args[-1] } |
369
|
|
|
|
|
|
|
#line $line $filename |
370
|
|
|
|
|
|
|
use $module \@{\$args[0]}; |
371
|
|
|
|
|
|
|
1; |
372
|
|
|
|
|
|
|
USE |
373
|
|
|
|
|
|
|
} |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
my ($eval_result, $eval_error) = _eval($code, \@imports, $warn); |
376
|
|
|
|
|
|
|
my $ok = $tb->ok( $eval_result, "use $module;" ); |
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
unless($ok) { |
379
|
|
|
|
|
|
|
chomp $eval_error; |
380
|
|
|
|
|
|
|
$@ =~ s{^BEGIN failed--compilation aborted at .*$} |
381
|
|
|
|
|
|
|
{BEGIN failed--compilation aborted at $filename line $line.}m; |
382
|
|
|
|
|
|
|
$tb->diag(<<DIAGNOSTIC); |
383
|
|
|
|
|
|
|
Tried to use '$module'. |
384
|
|
|
|
|
|
|
Error: $eval_error |
385
|
|
|
|
|
|
|
DIAGNOSTIC |
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
} |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
return $ok; |
390
|
|
|
|
|
|
|
} |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
my( $code, @args ) = @_; |
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
# Work around oddities surrounding resetting of $@ by immediately |
395
|
|
|
|
|
|
|
# storing it. |
396
|
|
|
|
|
|
|
my( $sigdie, $eval_result, $eval_error ); |
397
|
|
|
|
|
|
|
{ |
398
|
|
|
|
|
|
|
local( $@, $!, $SIG{__DIE__} ); # isolate eval |
399
|
|
|
|
|
|
|
$eval_result = eval $code; ## no critic (BuiltinFunctions::ProhibitStringyEval) |
400
|
|
|
|
|
|
|
$eval_error = $@; |
401
|
|
|
|
|
|
|
$sigdie = $SIG{__DIE__} || undef; |
402
|
7
|
|
|
7
|
1
|
30
|
} |
403
|
|
|
|
|
|
|
# make sure that $code got a chance to set $SIG{__DIE__} |
404
|
7
|
|
|
|
|
23
|
$SIG{__DIE__} = $sigdie if defined $sigdie; |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
return( $eval_result, $eval_error ); |
407
|
|
|
|
|
|
|
} |
408
|
0
|
|
|
0
|
1
|
0
|
|
409
|
|
|
|
|
|
|
|
410
|
0
|
|
|
|
|
0
|
#line 1092 |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
our( @Data_Stack, %Refs_Seen ); |
413
|
|
|
|
|
|
|
my $DNE = bless [], 'Does::Not::Exist'; |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
return ref $_[0] eq ref $DNE; |
416
|
|
|
|
|
|
|
} |
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
## no critic (Subroutines::RequireArgUnpacking) |
419
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
unless( @_ == 2 or @_ == 3 ) { |
422
|
|
|
|
|
|
|
my $msg = <<'WARNING'; |
423
|
|
|
|
|
|
|
is_deeply() takes two or three args, you gave %d. |
424
|
|
|
|
|
|
|
This usually means you passed an array or hash instead |
425
|
|
|
|
|
|
|
of a reference to it |
426
|
|
|
|
|
|
|
WARNING |
427
|
|
|
|
|
|
|
chop $msg; # clip off newline so carp() will put in line/file |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
_carp sprintf $msg, scalar @_; |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
return $tb->ok(0); |
432
|
|
|
|
|
|
|
} |
433
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
my( $got, $expected, $name ) = @_; |
435
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
$tb->_unoverload_str( \$expected, \$got ); |
437
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
my $ok; |
439
|
|
|
|
|
|
|
if( !ref $got and !ref $expected ) { # neither is a reference |
440
|
|
|
|
|
|
|
$ok = $tb->is_eq( $got, $expected, $name ); |
441
|
|
|
|
|
|
|
} |
442
|
|
|
|
|
|
|
elsif( !ref $got xor !ref $expected ) { # one's a reference, one isn't |
443
|
|
|
|
|
|
|
$ok = $tb->ok( 0, $name ); |
444
|
|
|
|
|
|
|
$tb->diag( _format_stack({ vals => [ $got, $expected ] }) ); |
445
|
|
|
|
|
|
|
} |
446
|
|
|
|
|
|
|
else { # both references |
447
|
0
|
|
|
0
|
1
|
0
|
local @Data_Stack = (); |
448
|
|
|
|
|
|
|
if( _deep_check( $got, $expected ) ) { |
449
|
0
|
|
|
|
|
0
|
$ok = $tb->ok( 1, $name ); |
450
|
|
|
|
|
|
|
} |
451
|
|
|
|
|
|
|
else { |
452
|
|
|
|
|
|
|
$ok = $tb->ok( 0, $name ); |
453
|
|
|
|
|
|
|
$tb->diag( _format_stack(@Data_Stack) ); |
454
|
|
|
|
|
|
|
} |
455
|
|
|
|
|
|
|
} |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
return $ok; |
458
|
|
|
|
|
|
|
} |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
my(@Stack) = @_; |
461
|
|
|
|
|
|
|
|
462
|
0
|
|
|
0
|
1
|
0
|
my $var = '$FOO'; |
463
|
|
|
|
|
|
|
my $did_arrow = 0; |
464
|
0
|
|
|
|
|
0
|
foreach my $entry (@Stack) { |
465
|
|
|
|
|
|
|
my $type = $entry->{type} || ''; |
466
|
|
|
|
|
|
|
my $idx = $entry->{'idx'}; |
467
|
|
|
|
|
|
|
if( $type eq 'HASH' ) { |
468
|
|
|
|
|
|
|
$var .= "->" unless $did_arrow++; |
469
|
|
|
|
|
|
|
$var .= "{$idx}"; |
470
|
|
|
|
|
|
|
} |
471
|
|
|
|
|
|
|
elsif( $type eq 'ARRAY' ) { |
472
|
|
|
|
|
|
|
$var .= "->" unless $did_arrow++; |
473
|
|
|
|
|
|
|
$var .= "[$idx]"; |
474
|
|
|
|
|
|
|
} |
475
|
|
|
|
|
|
|
elsif( $type eq 'REF' ) { |
476
|
|
|
|
|
|
|
$var = "\${$var}"; |
477
|
|
|
|
|
|
|
} |
478
|
|
|
|
|
|
|
} |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
my @vals = @{ $Stack[-1]{vals} }[ 0, 1 ]; |
481
|
|
|
|
|
|
|
my @vars = (); |
482
|
|
|
|
|
|
|
( $vars[0] = $var ) =~ s/\$FOO/ \$got/; |
483
|
|
|
|
|
|
|
( $vars[1] = $var ) =~ s/\$FOO/\$expected/; |
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
my $out = "Structures begin differing at:\n"; |
486
|
|
|
|
|
|
|
foreach my $idx ( 0 .. $#vals ) { |
487
|
|
|
|
|
|
|
my $val = $vals[$idx]; |
488
|
|
|
|
|
|
|
$vals[$idx] |
489
|
|
|
|
|
|
|
= !defined $val ? 'undef' |
490
|
|
|
|
|
|
|
: _dne($val) ? "Does not exist" |
491
|
|
|
|
|
|
|
: ref $val ? "$val" |
492
|
|
|
|
|
|
|
: "'$val'"; |
493
|
|
|
|
|
|
|
} |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
$out .= "$vars[0] = $vals[0]\n"; |
496
|
|
|
|
|
|
|
$out .= "$vars[1] = $vals[1]\n"; |
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
$out =~ s/^/ /msg; |
499
|
|
|
|
|
|
|
return $out; |
500
|
|
|
|
|
|
|
} |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
my $thing = shift; |
503
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
return '' if !ref $thing; |
505
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
for my $type (qw(Regexp ARRAY HASH REF SCALAR GLOB CODE VSTRING)) { |
507
|
|
|
|
|
|
|
return $type if UNIVERSAL::isa( $thing, $type ); |
508
|
0
|
|
|
0
|
1
|
0
|
} |
509
|
|
|
|
|
|
|
|
510
|
0
|
|
|
|
|
0
|
return ''; |
511
|
|
|
|
|
|
|
} |
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
#line 1252 |
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
return Test::More->builder->diag(@_); |
516
|
|
|
|
|
|
|
} |
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
return Test::More->builder->note(@_); |
519
|
|
|
|
|
|
|
} |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
#line 1278 |
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
return Test::More->builder->explain(@_); |
524
|
|
|
|
|
|
|
} |
525
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
#line 1344 |
527
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
## no critic (Subroutines::RequireFinalReturn) |
529
|
|
|
|
|
|
|
my( $why, $how_many ) = @_; |
530
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
# If the plan is set, and is static, then skip needs a count. If the plan |
533
|
|
|
|
|
|
|
# is 'no_plan' we are fine. As well if plan is undefined then we are |
534
|
|
|
|
|
|
|
# waiting for done_testing. |
535
|
|
|
|
|
|
|
unless (defined $how_many) { |
536
|
|
|
|
|
|
|
my $plan = $tb->has_plan; |
537
|
|
|
|
|
|
|
_carp "skip() needs to know \$how_many tests are in the block" |
538
|
|
|
|
|
|
|
if $plan && $plan =~ m/^\d+$/; |
539
|
|
|
|
|
|
|
$how_many = 1; |
540
|
|
|
|
|
|
|
} |
541
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
if( defined $how_many and $how_many =~ /\D/ ) { |
543
|
0
|
|
|
0
|
1
|
0
|
_carp |
544
|
0
|
|
0
|
|
|
0
|
"skip() was passed a non-numeric number of tests. Did you get the arguments backwards?"; |
545
|
0
|
|
|
|
|
0
|
$how_many = 1; |
546
|
|
|
|
|
|
|
} |
547
|
0
|
0
|
|
|
|
0
|
|
548
|
0
|
|
|
|
|
0
|
for( 1 .. $how_many ) { |
549
|
0
|
|
|
|
|
0
|
$tb->skip($why); |
550
|
0
|
|
|
|
|
0
|
} |
551
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
no warnings 'exiting'; |
553
|
0
|
0
|
|
|
|
0
|
last SKIP; |
554
|
0
|
|
|
|
|
0
|
} |
555
|
0
|
|
|
|
|
0
|
|
556
|
0
|
|
|
|
|
0
|
#line 1431 |
557
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
my( $why, $how_many ) = @_; |
559
|
0
|
|
|
|
|
0
|
my $tb = Test::More->builder; |
560
|
0
|
|
|
|
|
0
|
|
561
|
0
|
0
|
|
0
|
|
0
|
unless( defined $how_many ) { |
|
0
|
|
|
|
|
0
|
|
562
|
|
|
|
|
|
|
# $how_many can only be avoided when no_plan is in use. |
563
|
|
|
|
|
|
|
_carp "todo_skip() needs to know \$how_many tests are in the block" |
564
|
0
|
0
|
|
|
|
0
|
unless $tb->has_plan eq 'no_plan'; |
565
|
|
|
|
|
|
|
$how_many = 1; |
566
|
|
|
|
|
|
|
} |
567
|
0
|
|
|
|
|
0
|
|
568
|
|
|
|
|
|
|
for( 1 .. $how_many ) { |
569
|
0
|
|
|
|
|
0
|
$tb->todo_skip($why); |
570
|
|
|
|
|
|
|
} |
571
|
0
|
|
|
|
|
0
|
|
572
|
|
|
|
|
|
|
no warnings 'exiting'; |
573
|
|
|
|
|
|
|
last TODO; |
574
|
|
|
|
|
|
|
} |
575
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
#line 1486 |
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
my $reason = shift; |
579
|
|
|
|
|
|
|
my $tb = Test::More->builder; |
580
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
$tb->BAIL_OUT($reason); |
582
|
|
|
|
|
|
|
} |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
#line 1525 |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
#'# |
587
|
|
|
|
|
|
|
local @Data_Stack = (); |
588
|
|
|
|
|
|
|
_deep_check(@_); |
589
|
|
|
|
|
|
|
} |
590
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
my( $a1, $a2 ) = @_; |
592
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
if( grep _type($_) ne 'ARRAY', $a1, $a2 ) { |
594
|
|
|
|
|
|
|
warn "eq_array passed a non-array ref"; |
595
|
|
|
|
|
|
|
return 0; |
596
|
|
|
|
|
|
|
} |
597
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
return 1 if $a1 eq $a2; |
599
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
my $ok = 1; |
601
|
|
|
|
|
|
|
my $max = $#$a1 > $#$a2 ? $#$a1 : $#$a2; |
602
|
|
|
|
|
|
|
for( 0 .. $max ) { |
603
|
|
|
|
|
|
|
my $e1 = $_ > $#$a1 ? $DNE : $a1->[$_]; |
604
|
|
|
|
|
|
|
my $e2 = $_ > $#$a2 ? $DNE : $a2->[$_]; |
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
next if _equal_nonrefs($e1, $e2); |
607
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
push @Data_Stack, { type => 'ARRAY', idx => $_, vals => [ $e1, $e2 ] }; |
609
|
0
|
|
|
0
|
1
|
0
|
$ok = _deep_check( $e1, $e2 ); |
610
|
0
|
|
|
|
|
0
|
pop @Data_Stack if $ok; |
611
|
|
|
|
|
|
|
|
612
|
0
|
|
|
|
|
0
|
last unless $ok; |
613
|
0
|
0
|
|
|
|
0
|
} |
|
|
0
|
|
|
|
|
|
614
|
0
|
|
|
|
|
0
|
|
615
|
|
|
|
|
|
|
return $ok; |
616
|
|
|
|
|
|
|
} |
617
|
0
|
|
|
|
|
0
|
|
618
|
|
|
|
|
|
|
my( $e1, $e2 ) = @_; |
619
|
0
|
|
|
|
|
0
|
|
620
|
0
|
|
|
|
|
0
|
return if ref $e1 or ref $e2; |
621
|
0
|
0
|
|
|
|
0
|
|
622
|
0
|
|
|
|
|
0
|
if ( defined $e1 ) { |
623
|
|
|
|
|
|
|
return 1 if defined $e2 and $e1 eq $e2; |
624
|
|
|
|
|
|
|
} |
625
|
|
|
|
|
|
|
else { |
626
|
0
|
|
|
|
|
0
|
return 1 if !defined $e2; |
627
|
|
|
|
|
|
|
} |
628
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
return; |
630
|
0
|
|
|
0
|
|
0
|
} |
|
0
|
|
|
|
|
0
|
|
631
|
|
|
|
|
|
|
|
632
|
0
|
0
|
|
|
|
0
|
my( $e1, $e2 ) = @_; |
633
|
0
|
0
|
|
|
|
0
|
my $tb = Test::More->builder; |
634
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
my $ok = 0; |
636
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
# Effectively turn %Refs_Seen into a stack. This avoids picking up |
638
|
|
|
|
|
|
|
# the same referenced used twice (such as [\$a, \$a]) to be considered |
639
|
|
|
|
|
|
|
# circular. |
640
|
|
|
|
|
|
|
local %Refs_Seen = %Refs_Seen; |
641
|
0
|
0
|
|
|
|
0
|
|
642
|
0
|
|
|
|
|
0
|
{ |
643
|
|
|
|
|
|
|
$tb->_unoverload_str( \$e1, \$e2 ); |
644
|
|
|
|
|
|
|
|
645
|
0
|
|
|
|
|
0
|
# Either they're both references or both not. |
646
|
0
|
0
|
|
|
|
0
|
my $same_ref = !( !ref $e1 xor !ref $e2 ); |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
647
|
0
|
|
|
|
|
0
|
my $not_ref = ( !ref $e1 and !ref $e2 ); |
648
|
0
|
0
|
|
|
|
0
|
|
649
|
|
|
|
|
|
|
if( defined $e1 xor defined $e2 ) { |
650
|
|
|
|
|
|
|
$ok = 0; |
651
|
0
|
|
|
|
|
0
|
} |
652
|
0
|
|
|
|
|
0
|
elsif( !defined $e1 and !defined $e2 ) { |
653
|
0
|
|
|
|
|
0
|
# Shortcut if they're both undefined. |
654
|
0
|
|
|
|
|
0
|
$ok = 1; |
655
|
|
|
|
|
|
|
} |
656
|
|
|
|
|
|
|
elsif( _dne($e1) xor _dne($e2) ) { |
657
|
0
|
|
|
|
|
0
|
$ok = 0; |
658
|
0
|
|
|
|
|
0
|
} |
659
|
0
|
|
|
|
|
0
|
elsif( $same_ref and( $e1 eq $e2 ) ) { |
660
|
0
|
|
|
|
|
0
|
$ok = 1; |
661
|
|
|
|
|
|
|
} |
662
|
|
|
|
|
|
|
elsif($not_ref) { |
663
|
0
|
|
|
|
|
0
|
push @Data_Stack, { type => '', vals => [ $e1, $e2 ] }; |
664
|
0
|
|
|
|
|
0
|
$ok = 0; |
665
|
0
|
|
|
|
|
0
|
} |
666
|
|
|
|
|
|
|
else { |
667
|
|
|
|
|
|
|
if( $Refs_Seen{$e1} ) { |
668
|
0
|
|
|
|
|
0
|
return $Refs_Seen{$e1} eq $e2; |
669
|
0
|
|
|
|
|
0
|
} |
670
|
0
|
|
|
|
|
0
|
else { |
671
|
|
|
|
|
|
|
$Refs_Seen{$e1} = "$e2"; |
672
|
|
|
|
|
|
|
} |
673
|
0
|
|
|
|
|
0
|
|
674
|
|
|
|
|
|
|
my $type = _type($e1); |
675
|
|
|
|
|
|
|
$type = 'DIFFERENT' unless _type($e2) eq $type; |
676
|
0
|
|
|
|
|
0
|
|
677
|
0
|
0
|
|
|
|
0
|
if( $type eq 'DIFFERENT' ) { |
678
|
0
|
|
|
|
|
0
|
push @Data_Stack, { type => $type, vals => [ $e1, $e2 ] }; |
679
|
|
|
|
|
|
|
$ok = 0; |
680
|
|
|
|
|
|
|
} |
681
|
0
|
|
|
|
|
0
|
elsif( $type eq 'ARRAY' ) { |
682
|
0
|
|
|
|
|
0
|
$ok = _eq_array( $e1, $e2 ); |
683
|
|
|
|
|
|
|
} |
684
|
|
|
|
|
|
|
elsif( $type eq 'HASH' ) { |
685
|
0
|
|
|
|
|
0
|
$ok = _eq_hash( $e1, $e2 ); |
686
|
|
|
|
|
|
|
} |
687
|
|
|
|
|
|
|
elsif( $type eq 'REF' ) { |
688
|
|
|
|
|
|
|
push @Data_Stack, { type => $type, vals => [ $e1, $e2 ] }; |
689
|
|
|
|
|
|
|
$ok = _deep_check( $$e1, $$e2 ); |
690
|
|
|
|
|
|
|
pop @Data_Stack if $ok; |
691
|
|
|
|
|
|
|
} |
692
|
|
|
|
|
|
|
elsif( $type eq 'SCALAR' ) { |
693
|
|
|
|
|
|
|
push @Data_Stack, { type => 'REF', vals => [ $e1, $e2 ] }; |
694
|
|
|
|
|
|
|
$ok = _deep_check( $$e1, $$e2 ); |
695
|
|
|
|
|
|
|
pop @Data_Stack if $ok; |
696
|
|
|
|
|
|
|
} |
697
|
|
|
|
|
|
|
elsif($type) { |
698
|
|
|
|
|
|
|
push @Data_Stack, { type => $type, vals => [ $e1, $e2 ] }; |
699
|
|
|
|
|
|
|
$ok = 0; |
700
|
|
|
|
|
|
|
} |
701
|
|
|
|
|
|
|
else { |
702
|
|
|
|
|
|
|
_whoa( 1, "No type in _deep_check" ); |
703
|
|
|
|
|
|
|
} |
704
|
|
|
|
|
|
|
} |
705
|
|
|
|
|
|
|
} |
706
|
|
|
|
|
|
|
|
707
|
|
|
|
|
|
|
return $ok; |
708
|
|
|
|
|
|
|
} |
709
|
|
|
|
|
|
|
|
710
|
0
|
|
|
0
|
1
|
0
|
my( $check, $desc ) = @_; |
711
|
0
|
0
|
|
|
|
0
|
if($check) { |
712
|
|
|
|
|
|
|
die <<"WHOA"; |
713
|
0
|
|
|
|
|
0
|
WHOA! $desc |
714
|
|
|
|
|
|
|
This should never happen! Please contact the author immediately! |
715
|
0
|
|
0
|
|
|
0
|
WHOA |
716
|
|
|
|
|
|
|
} |
717
|
0
|
|
|
|
|
0
|
} |
718
|
0
|
|
|
0
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
719
|
0
|
0
|
|
|
|
0
|
#line 1672 |
720
|
0
|
|
|
|
|
0
|
|
721
|
0
|
|
|
|
|
0
|
local @Data_Stack = (); |
722
|
|
|
|
|
|
|
return _deep_check(@_); |
723
|
|
|
|
|
|
|
} |
724
|
0
|
0
|
|
|
|
0
|
|
725
|
0
|
|
|
|
|
0
|
my( $a1, $a2 ) = @_; |
726
|
0
|
|
|
|
|
0
|
|
727
|
|
|
|
|
|
|
if( grep _type($_) ne 'HASH', $a1, $a2 ) { |
728
|
|
|
|
|
|
|
warn "eq_hash passed a non-hash ref"; |
729
|
0
|
|
|
|
|
0
|
return 0; |
730
|
|
|
|
|
|
|
} |
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
return 1 if $a1 eq $a2; |
733
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
my $ok = 1; |
735
|
|
|
|
|
|
|
my $bigger = keys %$a1 > keys %$a2 ? $a1 : $a2; |
736
|
|
|
|
|
|
|
foreach my $k ( keys %$bigger ) { |
737
|
|
|
|
|
|
|
my $e1 = exists $a1->{$k} ? $a1->{$k} : $DNE; |
738
|
|
|
|
|
|
|
my $e2 = exists $a2->{$k} ? $a2->{$k} : $DNE; |
739
|
|
|
|
|
|
|
|
740
|
|
|
|
|
|
|
next if _equal_nonrefs($e1, $e2); |
741
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
push @Data_Stack, { type => 'HASH', idx => $k, vals => [ $e1, $e2 ] }; |
743
|
|
|
|
|
|
|
$ok = _deep_check( $e1, $e2 ); |
744
|
|
|
|
|
|
|
pop @Data_Stack if $ok; |
745
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
last unless $ok; |
747
|
|
|
|
|
|
|
} |
748
|
|
|
|
|
|
|
|
749
|
|
|
|
|
|
|
return $ok; |
750
|
|
|
|
|
|
|
} |
751
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
#line 1731 |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
my( $a1, $a2 ) = @_; |
755
|
|
|
|
|
|
|
return 0 unless @$a1 == @$a2; |
756
|
|
|
|
|
|
|
|
757
|
|
|
|
|
|
|
no warnings 'uninitialized'; |
758
|
|
|
|
|
|
|
|
759
|
|
|
|
|
|
|
# It really doesn't matter how we sort them, as long as both arrays are |
760
|
|
|
|
|
|
|
# sorted with the same algorithm. |
761
|
|
|
|
|
|
|
# |
762
|
|
|
|
|
|
|
# Ensure that references are not accidentally treated the same as a |
763
|
|
|
|
|
|
|
# string containing the reference. |
764
|
|
|
|
|
|
|
# |
765
|
|
|
|
|
|
|
# Have to inline the sort routine due to a threading/sort bug. |
766
|
|
|
|
|
|
|
# See [rt.cpan.org 6782] |
767
|
|
|
|
|
|
|
# |
768
|
|
|
|
|
|
|
# I don't know how references would be sorted so we just don't sort |
769
|
|
|
|
|
|
|
# them. This means eq_set doesn't really work with refs. |
770
|
|
|
|
|
|
|
return eq_array( |
771
|
|
|
|
|
|
|
[ grep( ref, @$a1 ), sort( grep( !ref, @$a1 ) ) ], |
772
|
|
|
|
|
|
|
[ grep( ref, @$a2 ), sort( grep( !ref, @$a2 ) ) ], |
773
|
|
|
|
|
|
|
); |
774
|
|
|
|
|
|
|
} |
775
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
#line 1995 |
777
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
1; |