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';
22 my $b = check { $a } { get => 1 }, 'assign to';
23 is $b, $n, 'scalar: assign to correctly';
25 $b = check { "X${a}Y" } { get => 1 }, 'interpolate';
26 is $b, "X${n}Y", 'scalar: interpolate correctly';
28 $b = check { \$a } { }, 'reference';
30 check { $a = 123; () } { set => 1 }, 'assign to';
32 check { ++$a; () } { get => 1, set => 1 }, 'increment';
34 check { --$a; () } { get => 1, set => 1 }, 'decrement';
36 check { $a *= 1.5; () } { get => 1, set => 1 }, 'multiply in place';
38 check { $a /= 1.5; () } { get => 1, set => 1 }, 'divide in place';
42 check { cast $b, $wiz } { }, 'cast 2';
43 } { free => 1 }, 'scope end';
45 check { undef $a } { set => 1 }, 'undef';
47 check { dispell $a, $wiz } { }, 'dispell';