6 use Test::More tests => 21;
8 use Variable::Magic qw/wizard cast dispell/;
14 for (0 .. 4) { return 0 unless $c[$_] == $x[$_]; }
18 my $wiz = wizard get => sub { ++$c[0] },
19 set => sub { ++$c[1] },
20 len => sub { ++$c[2]; $_[2] },
21 clear => sub { ++$c[3] },
22 free => sub { ++$c[4] };
23 ok(check(), 'array : create wizard');
25 my @n = map { int rand 1000 } 1 .. 5;
29 ok(check(), 'array : cast');
32 ok(check(), 'array : assign element to');
36 ok(check(), 'array : assign to');
40 ok(check(), 'array : interpolate');
43 ok(check(), 'array : reference');
46 ok(check(), 'array : slice');
50 ok(check(), 'array : assign');
53 ok(check(), 'array : assign old element');
57 ok(check(), 'array : assign new element');
60 ++$x[1]; ++$x[2] unless $^V && $^V gt 5.9.2; # since 5.9.3
61 ok(check(), 'array : push');
65 ok(check(), 'array : pop');
69 ok(check(), 'array : unshift');
73 ok(check(), 'array : shift');
77 ok(check(), 'array : length');
80 $x[1] += 4; ++$x[2]; ++$x[3];
81 ok(check(), 'array : map');
83 @b = grep { defined && $_ >= ord('b') } @a;
85 ok(check(), 'array : grep');
89 ok(check(), 'array : for');
96 ok(check(), 'array : scope end');
99 ++$x[3] if $^V && $^V gt 5.9.4; # since 5.9.5 - see #43357
100 ok(check(), 'array : undef');
103 ok(check(), 'array : dispel');