use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More tests => 7;
-use Variable::Magic qw/wizard cast/;
+use Variable::Magic qw/wizard cast getdata/;
our $destroyed;
is $destroyed, 1;
}
+
+{
+ local $destroyed = 0;
+
+ my $w = wizard data => sub { $_[1] };
+
+ {
+ my $copy;
+
+ {
+ my $obj = D->new;
+
+ {
+ my $x = 1;
+ cast $x, $w, $obj;
+ is $destroyed, 0;
+ $copy = getdata $x, $w;
+ }
+
+ is $destroyed, 0;
+ }
+
+ is $destroyed, 0;
+ }
+
+ is $destroyed, 1;
+}