]> git.vpit.fr Git - perl/modules/Thread-Cleanup.git/blobdiff - t/11-detach.t
Test that detached threads destructors don't fire before END
[perl/modules/Thread-Cleanup.git] / t / 11-detach.t
index 3c641666c96a5ca6845380ff3461b5627a87d95c..32339aed251d7deef0323c1441d54627d7130146 100644 (file)
@@ -16,7 +16,7 @@ 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;
 
@@ -80,8 +80,12 @@ 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;
 }