X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F41-clone.t;h=e5ae4986d2a10fa7dc655c59e2e269fb7d524be2;hb=02f8f67606edc22d31e01944a649f5e0824b33ba;hp=032fa92d3b85e8072406322700b9e7e5e211a457;hpb=74324ad0624c0816fb654b8eddf926ad168ec5e0;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/t/41-clone.t b/t/41-clone.t index 032fa92..e5ae498 100644 --- a/t/41-clone.t +++ b/t/41-clone.t @@ -22,6 +22,10 @@ use Variable::Magic qw/wizard cast dispell getdata getsig VMG_THREADSAFE/; if (VMG_THREADSAFE) { plan tests => 3 + 2 * (2 * 8 + 2) + 2 * (2 * 5 + 2); + my $v = $threads::VERSION; + diag "Using threads $v" if defined $v; + $v = $threads::shared::VERSION; + diag "Using threads::shared $v" if defined $v; diag 'This will leak a few scalars'; } else { plan skip_all => 'This Variable::Magic isn\'t thread safe'; @@ -29,9 +33,11 @@ if (VMG_THREADSAFE) { my $destroyed : shared = 0; my $c : shared = 0; -my $wiz = wizard get => sub { ++$c }, - data => sub { $_[1] + threads->tid() }, - free => sub { ++$destroyed }; +my $wiz = eval { + wizard get => sub { ++$c }, + data => sub { $_[1] + threads->tid() }, + free => sub { ++$destroyed } +}; is($@, '', "wizard in main thread doesn't croak"); isnt($wiz, undef, "wizard in main thread is defined"); is($c, 0, "wizard in main thread doesn't trigger magic");