Add a thread test (just runs the basic one in a thread)
Peter Rabbitson [Sat, 31 Mar 2012 16:03:02 +0000 (18:03 +0200)]
t/01_basic.t [moved from t/basic.t with 97% similarity]
t/02_thread.t [new file with mode: 0644]

similarity index 97%
rename from t/basic.t
rename to t/01_basic.t
index 84db72a..8584247 100644 (file)
--- a/t/basic.t
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
 use strict;
 use warnings;
 
@@ -29,5 +27,3 @@ ok( defined &in_global_destruction, "exported" );
 ok( !in_global_destruction(), "not in GD" );
 
 our $sg = Test::Scope::Guard->new(sub { ok( in_global_destruction(), "in GD" ) });
-
-
diff --git a/t/02_thread.t b/t/02_thread.t
new file mode 100644 (file)
index 0000000..0f26b0a
--- /dev/null
@@ -0,0 +1,23 @@
+use Config;
+BEGIN {
+  unless ($Config{useithreads}) {
+    print "1..0 # SKIP your perl does not support ithreads\n";
+    exit 0;
+  }
+}
+
+BEGIN {
+  unless (eval { require threads }) {
+    print "1..0 # SKIP threads.pm not installed\n";
+    exit 0;
+  }
+}
+
+use threads;
+use warnings;
+use strict;
+
+my $t = threads->create(sub { do 't/01_basic.t' });
+$t->join;
+
+exit 0;