]> git.vpit.fr Git - perl/modules/Thread-Cleanup.git/blobdiff - t/11-detach.t
Move the module version diagnostics higher in t/1*
[perl/modules/Thread-Cleanup.git] / t / 11-detach.t
index 3c641666c96a5ca6845380ff3461b5627a87d95c..620af76a3fdf01a32d51a5b6d8d1ecf391648386 100644 (file)
@@ -16,10 +16,13 @@ BEGIN {
 use threads;
 use threads::shared;
 
-use Test::More tests => 5 * (2 + 2) + 1;
+use Test::More tests => 5 * (2 + 2 + 1) + 1;
 
 use Thread::Cleanup;
 
+diag "Using threads $threads::VERSION";
+diag "Using threads::shared $threads::shared::VERSION";
+
 my %called : shared;
 my %nums   : shared;
 
@@ -71,17 +74,18 @@ my @t = map {
  $thr;
 } 0 .. 4;
 
-diag "Using threads $threads::VERSION";
-diag "Using threads::shared $threads::shared::VERSION";
-
 $_->detach for @t;
 
 sleep 2;
 
 is $x, -1, '$x in the main thread';
 
-is $ran{$_},    1, "thread $_ was run once" for @tids;
+for (@tids) {
+ is $ran{$_},    1,     "thread $_ was run once";
+ is $called{$_}, undef, "thread $_ destructor wasn't called yet";
+}
 
 END {
- is $called{$_}, 1, "thread $_ destructor was called once" for @tids;
+ is $called{$_}, 1, "thread $_ destructor was called once at END time"
+                                                                      for @tids;
 }