Attribute-Property
view release on metacpan or search on metacpan
t/lib/Test/Builder.pm view on Meta::CPAN
my $IsVMS = $^O eq 'VMS';
use vars qw($Level);
my @Test_Results = ();
my @Test_Details = ();
my($Test_Died) = 0;
my($Have_Plan) = 0;
my $Curr_Test = 0;
# Make Test::Builder thread-safe for ithreads.
BEGIN {
use Config;
if( $] >= 5.008 && $Config{useithreads} ) {
require threads;
require threads::shared;
threads::shared->import;
share(\$Curr_Test);
share(\@Test_Details);
share(\@Test_Results);
}
else {
*lock = sub { 0 };
}
}
t/lib/Test/Builder.pm view on Meta::CPAN
ok 2
ok 3
or this if false
ok
ok
ok
Most useful when you can't depend on the test output order, such as
when threads or forking is involved.
Test::Harness will accept either, but avoid mixing the two styles.
Defaults to on.
=cut
my $Use_Nums = 1;
sub use_numbers {
my($self, $use_nums) = @_;
t/lib/Test/Builder.pm view on Meta::CPAN
do{ _my_exit(0) && return } if !$Have_Plan;
# Figure out if we passed or failed and print helpful messages.
if( @Test_Results ) {
# The plan? We have no plan.
if( $No_Plan ) {
$self->_print("1..$Curr_Test\n") unless $self->no_header;
$Expected_Tests = $Curr_Test;
}
# 5.8.0 threads bug. Shared arrays will not be auto-extended
# by a slice.
$Test_Results[$Expected_Tests-1] = undef
unless defined $Test_Results[$Expected_Tests-1];
my $num_failed = grep !$_, @Test_Results[0..$Expected_Tests-1];
$num_failed += abs($Expected_Tests - @Test_Results);
if( $Curr_Test < $Expected_Tests ) {
$self->diag(<<"FAIL");
Looks like you planned $Expected_Tests tests but only ran $Curr_Test.
t/lib/Test/Builder.pm view on Meta::CPAN
_my_exit( 255 ) && return;
}
}
END {
$Test->_ending if defined $Test and !$Test->no_ending;
}
=head1 THREADS
In perl 5.8.0 and later, Test::Builder is thread-safe. The test
number is shared amongst all threads. This means if one thread sets
the test number using current_test() they will all be effected.
=head1 EXAMPLES
CPAN can provide the best examples. Test::Simple, Test::More,
Test::Exception and Test::Differences all use Test::Builder.
=head1 SEE ALSO
Test::Simple, Test::More, Test::Harness
t/lib/Test/More.pm view on Meta::CPAN
return Test::Builder->new;
}
=back
=head1 NOTES
Test::More is B<explicitly> tested all the way back to perl 5.004.
Test::More is thread-safe for perl 5.8.0 and up.
=head1 BUGS and CAVEATS
=over 4
=item Making your own ok()
If you are trying to extend Test::More, don't. Use Test::Builder
instead.
( run in 2.381 seconds using v1.01-cache-2.11-cpan-3cd7ad12f66 )