8 use Variable::Magic qw/wizard cast MGf_COPY/;
11 plan skip_all => "this perl doesn't handle copy magic";
17 my $wiz = wizard copy => sub { ++$c };
18 ok($c == 0, 'copy : create wizard');
22 tie my @a, 'Tie::StdArray';
24 ok($c == 0, 'copy (array) : cast');
28 ok($c == 1, 'copy (array) : store element');
31 ok($c == 2, 'copy (array) : exists element');
32 ok($e, 'copy (array) : exists element, really');
35 ok($c == 3, 'copy (array) : fetch element');
36 ok($b == $n, 'copy (array) : fetch element correctly');
42 tie my %h, 'Tie::StdHash';
44 ok($c == 0, 'copy (hash) : cast');
46 my ($k, $v) = (time, int rand time);
48 ok($c == 1, 'copy (hash) : store element');
51 ok($c == 2, 'copy (hash) : exists element');
52 ok($e, 'copy (hash) : exists element, really');
55 ok($c == 3, 'copy (hash) : fetch element');
56 ok($w == $v, 'copy (hash) : fetch element correctly');
58 my ($K, $V) = each %h;
59 ok($c == 4, 'copy (hash) : iterate');
60 ok($k == $K && $v == $V, 'copy (hash) : iterate correctly');
63 ok($c == 5, 'copy (hash) : delete');