From: Vincent Pit Date: Tue, 24 Mar 2009 01:30:06 +0000 (+0100) Subject: Test that detached threads destructors don't fire before END X-Git-Tag: v0.02~7 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=4c809697b9f79c6f752911f19642becfdff2dd87;p=perl%2Fmodules%2FThread-Cleanup.git Test that detached threads destructors don't fire before END --- diff --git a/t/11-detach.t b/t/11-detach.t index 3c64166..32339ae 100644 --- a/t/11-detach.t +++ b/t/11-detach.t @@ -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; }