+sub spawn_wiz {
+ my ($op_info) = @_;
+
+ my $wiz = eval {
+ wizard data => sub { $_[1] + threads->tid() },
+ get => sub { lock $c; ++$c; 0 },
+ set => sub {
+ my $op = $_[-1];
+ my $tid = threads->tid();
+ if ($op_info == VMG_OP_INFO_OBJECT) {
+ is_deeply { class => ref($op), name => $op->name },
+ { class => 'B::BINOP', name => 'sassign' },
+ "op object in thread $tid is correct";
+ } else {
+ is $op, 'sassign', "op name in thread $tid is correct";
+ }
+ 0
+ },
+ free => sub { lock $destroyed; ++$destroyed; 0 },
+ op_info => $op_info
+ };
+ is($@, '', "wizard with op_info $op_info in main thread doesn't croak");
+ isnt($wiz, undef, "wizard with op_info $op_info in main thread is defined");
+ is($c, 0, "wizard with op_info $op_info in main thread doesn't trigger magic");
+
+ return $wiz;
+}