X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F41-clone.t;h=c3c48223ed666c5d9760cb109ff186f8c3133ddd;hb=997fe5643a5c203315ff26f4e4bf7840fb33a9d8;hp=032fa92d3b85e8072406322700b9e7e5e211a457;hpb=74324ad0624c0816fb654b8eddf926ad168ec5e0;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/t/41-clone.t b/t/41-clone.t index 032fa92..c3c4822 100644 --- a/t/41-clone.t +++ b/t/41-clone.t @@ -22,16 +22,21 @@ 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); - diag 'This will leak a few scalars'; + my $v = $threads::VERSION; + diag "Using threads $v" if defined $v; + $v = $threads::shared::VERSION; + diag "Using threads::shared $v" if defined $v; } else { plan skip_all => 'This Variable::Magic isn\'t thread safe'; } 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");