]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - t/41-clone.t
This is 0.64
[perl/modules/Variable-Magic.git] / t / 41-clone.t
index 1efd250bd13f6c8a0b59c6401256f70804bda238..a35a2a57303ee8c811d1971dbba66c0be9a97379 100644 (file)
@@ -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';
   }
  }
 }