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;
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;
}