6 use Test::More tests => 2 * 14 + 2 + 1;
8 use Variable::Magic qw/cast dispell/;
11 use Variable::Magic::TestWatcher;
14 [ qw/get set len clear free copy dup local fetch store exists delete/ ],
17 my $n = int rand 1000;
20 check { cast $a, $wiz } { }, 'cast';
23 check { $b = $a } { get => 1 }, 'assign to';
24 is $b, $n, 'scalar: assign to correctly';
26 check { $b = "X${a}Y" } { get => 1 }, 'interpolate';
27 is $b, "X${n}Y", 'scalar: interpolate correctly';
29 check { $b = \$a } { }, 'reference';
31 check { $a = 123; () } { set => 1 }, 'assign to';
33 check { ++$a; () } { get => 1, set => 1 }, 'increment';
35 check { --$a; () } { get => 1, set => 1 }, 'decrement';
37 check { $a *= 1.5; () } { get => 1, set => 1 }, 'multiply in place';
39 check { $a /= 1.5; () } { get => 1, set => 1 }, 'divide in place';
43 check { cast $b, $wiz } { }, 'cast 2';
44 } { free => 1 }, 'scope end';
46 check { undef $a } { set => 1 }, 'undef';
48 check { dispell $a, $wiz } { }, 'dispell';