summaryrefslogtreecommitdiff
path: root/cpan/Test-Simple/t/threads.t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-10-02 16:19:41 +0100
committerNicholas Clark <nick@ccl4.org>2009-10-02 16:19:41 +0100
commite0ee75a6976f08f9bc3868227f1cd11ab6507895 (patch)
tree5366acf520d51f2f3961274ced349a4178685be5 /cpan/Test-Simple/t/threads.t
parent8c5b8ff02c62badaeb38078556879720bdf8945a (diff)
downloadperl-e0ee75a6976f08f9bc3868227f1cd11ab6507895.tar.gz
Move Test::Simple from ext/ to cpan/
Diffstat (limited to 'cpan/Test-Simple/t/threads.t')
-rw-r--r--cpan/Test-Simple/t/threads.t33
1 files changed, 33 insertions, 0 deletions
diff --git a/cpan/Test-Simple/t/threads.t b/cpan/Test-Simple/t/threads.t
new file mode 100644
index 0000000000..42ba8c269c
--- /dev/null
+++ b/cpan/Test-Simple/t/threads.t
@@ -0,0 +1,33 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ if( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = '../lib';
+ }
+}
+
+use Config;
+BEGIN {
+ unless ( $] >= 5.008001 && $Config{'useithreads'} &&
+ eval { require threads; 'threads'->import; 1; })
+ {
+ print "1..0 # Skip: no working threads\n";
+ exit 0;
+ }
+}
+
+use strict;
+use Test::Builder;
+
+my $Test = Test::Builder->new;
+$Test->exported_to('main');
+$Test->plan(tests => 6);
+
+for(1..5) {
+ 'threads'->create(sub {
+ $Test->ok(1,"Each of these should app the test number")
+ })->join;
+}
+
+$Test->is_num($Test->current_test(), 5,"Should be five");