X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F41-clone.t;h=a35a2a57303ee8c811d1971dbba66c0be9a97379;hb=33e50e22dc4df6fd53e90e57e4bab26b46a315cb;hp=1efd250bd13f6c8a0b59c6401256f70804bda238;hpb=be3665d8224dfbb9cff5f53796500821d9c8185a;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/t/41-clone.t b/t/41-clone.t index 1efd250..a35a2a5 100644 --- a/t/41-clone.t +++ b/t/41-clone.t @@ -32,12 +32,15 @@ sub spawn_wiz { my $op = $_[-1]; my $tid = threads->tid(); + my $assign_op = ("$]" < 5.037_003) ? 'sassign': 'padsv_store'; + my $assign_op_cl = ("$]" < 5.037_003) ? 'B::BINOP': 'B::UNOP'; + if ($op_info == VMG_OP_INFO_OBJECT) { is_deeply { class => ref($op), name => $op->name }, - { class => 'B::BINOP', name => 'sassign' }, + { class => $assign_op_cl, name => $assign_op }, "op object in thread $tid is correct"; } else { - is $op, 'sassign', "op name in thread $tid is correct"; + is $op, $assign_op, "op name in thread $tid is correct"; } return 0 @@ -102,7 +105,7 @@ sub try { } } - return; + return 1; } my $wiz_name = spawn_wiz VMG_OP_INFO_NAME; @@ -119,16 +122,21 @@ for my $dispell (1, 0) { $destroyed = 0; } + my $completed = 0; + my @threads = map spawn(\&try, $dispell, $wiz), 1 .. 2; - $_->join for @threads; + for my $thr (@threads) { + my $res = $thr->join; + $completed += $res if defined $res; + } { lock $c; - is $c, 2, "get triggered twice"; + is $c, $completed, "get triggered twice"; } { lock $destroyed; - is $destroyed, (1 - $dispell) * 2, 'destructors'; + is $destroyed, (1 - $dispell) * $completed, 'destructors'; } } }