Acme-Coro-Suke
view release on metacpan or search on metacpan
inc/Test/Builder.pm view on Meta::CPAN
891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374our
$VERSION
=
'0.94'
;
$VERSION
=
eval
$VERSION
;
## no critic (BuiltinFunctions::ProhibitStringyEval)
BEGIN {
if
( $] < 5.008 ) {
}
}
# Make Test::Builder thread-safe for ithreads.
BEGIN {
# Load threads::shared when threads are turned on.
# 5.8.0's threads are so busted we no longer support them.
if
( $] >= 5.008001 &&
$Config
{useithreads} &&
$INC
{
'threads.pm'
} ) {
# Hack around YET ANOTHER threads::shared bug. It would
# occassionally forget the contents of the variable when sharing it.
# So we first copy the data, then share, then put our copy back.
*share
=
sub
(\[$@%]) {
my
$type
=
ref
$_
[0];
my
$data
;
if
(
$type
eq
'HASH'
) {
%$data
= %{
$_
[0] };
}
elsif
(
$type
eq
'ARRAY'
) {
@$data
= @{
$_
[0] };
}
elsif
(
$type
eq
'SCALAR'
) {
$$data
= ${
$_
[0] };
}
else
{
die
(
"Unknown type: "
.
$type
);
}
$_
[0] =
&threads::shared::share
(
$_
[0] );
if
(
$type
eq
'HASH'
) {
%{
$_
[0] } =
%$data
;
}
elsif
(
$type
eq
'ARRAY'
) {
@{
$_
[0] } =
@$data
;
}
elsif
(
$type
eq
'SCALAR'
) {
${
$_
[0] } =
$$data
;
}
else
{
die
(
"Unknown type: "
.
$type
);
}
return
$_
[0];
};
}
# 5.8.0's threads::shared is busted when threads are off
# and earlier Perls just don't have that module at all.
else
{
*share
=
sub
{
return
$_
[0] };
*lock
=
sub
{ 0 };
}
}
#line 117
our
$Test
= Test::Builder->new;
inc/Test/Builder.pm view on Meta::CPAN
15001501150215031504150515061507150815091510151115121513151415151516151715181519my
$test_results
=
$self
->{Test_Results};
if
(
@$test_results
) {
# The plan? We have no plan.
if
(
$self
->{No_Plan} ) {
$self
->_output_plan(
$self
->{Curr_Test})
unless
$self
->no_header;
$self
->{Expected_Tests} =
$self
->{Curr_Test};
}
# Auto-extended arrays and elements which aren't explicitly
# filled in with a shared reference will puke under 5.8.0
# ithreads. So we have to fill them in by hand. :(
my
$empty_result
=
&share
( {} );
for
my
$idx
( 0 ..
$self
->{Expected_Tests} - 1 ) {
$test_results
->[
$idx
] =
$empty_result
unless
defined
$test_results
->[
$idx
];
}
my
$num_failed
=
grep
!
$_
->{
'ok'
}, @{
$test_results
}[ 0 ..
$self
->{Curr_Test} - 1 ];
my
$num_extra
=
$self
->{Curr_Test} -
$self
->{Expected_Tests};
inc/Test/More.pm view on Meta::CPAN
723724725726727728729730731732733734735736737738739740741742
return
0
unless
@$a1
==
@$a2
;
no
warnings
'uninitialized'
;
# It really doesn't matter how we sort them, as long as both arrays are
# sorted with the same algorithm.
#
# Ensure that references are not accidentally treated the same as a
# string containing the reference.
#
# Have to inline the sort routine due to a threading/sort bug.
# See [rt.cpan.org 6782]
#
# I don't know how references would be sorted so we just don't sort
# them. This means eq_set doesn't really work with refs.
return
eq_array(
[
grep
(
ref
,
@$a1
),
sort
(
grep
( !
ref
,
@$a1
) ) ],
[
grep
(
ref
,
@$a2
),
sort
(
grep
( !
ref
,
@$a2
) ) ],
);
}
( run in 0.284 second using v1.01-cache-2.11-cpan-496ff517765 )