+use Test::More 'no_plan';
+
+use Variable::Magic qw<
+ wizard cast dispell getdata
+ VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT
+>;
+
+my $destroyed : shared = 0;
+my $c : shared = 0;
+
+sub spawn_wiz {
+ my ($op_info) = @_;
+
+ my $desc = "wizard with op_info $op_info in main thread";
+
+ local $@;
+ 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";
+ }
+
+ return 0
+ },
+ free => sub { lock $destroyed; ++$destroyed; 0 },
+ op_info => $op_info,
+ );
+ };
+ is $@, '', "$desc doesn't croak";
+ isnt $wiz, undef, "$desc is defined";
+ is $c, 0, "$desc doesn't trigger magic";
+
+ return $wiz;