X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F11-detach.t;h=ef0b3f87c8ccb0774506eff5a39d2770d4948c19;hb=86915a65eed5d806e6c48b8b8fda1d3c4d990987;hp=3c641666c96a5ca6845380ff3461b5627a87d95c;hpb=15b9171b2fc61b12e0dcc123369fc2b66fe87012;p=perl%2Fmodules%2FThread-Cleanup.git diff --git a/t/11-detach.t b/t/11-detach.t index 3c64166..ef0b3f8 100644 --- a/t/11-detach.t +++ b/t/11-detach.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Config qw/%Config/; +use Config qw<%Config>; BEGIN { if (!$Config{useithreads}) { @@ -16,7 +16,12 @@ BEGIN { use threads; use threads::shared; -use Test::More tests => 5 * (2 + 2) + 1; +use Test::More tests => 5 * (2 + 2 + 1) + 1; + +BEGIN { + defined and diag "Using threads $_" for $threads::VERSION; + defined and diag "Using threads::shared $_" for $threads::shared::VERSION; +} use Thread::Cleanup; @@ -71,17 +76,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; }