6 use Test::More tests => (2 * 5 + 2) + (2 * 2 + 1) + 1;
8 use Variable::Magic qw/cast dispell/;
11 use Variable::Magic::TestWatcher;
12 use Variable::Magic::TestValue;
14 my $wiz = init_watcher 'clear', 'clear';
18 watch { cast @a, $wiz } { }, 'cast array';
20 watch { @a = () } { clear => 1 }, 'clear array';
21 is_deeply \@a, [ ], 'clear: clear array correctly';
23 my %h = (foo => 1, bar => 2);
25 watch { cast %h, $wiz } { }, 'cast hash';
27 watch { %h = () } { clear => 1 }, 'clear hash';
28 is_deeply \%h, { }, 'clear: clear hash correctly';
33 my $wv = init_value @val, 'clear', 'clear';
35 value { @val = () } [ 4 .. 6 ];
38 is_deeply \@val, [ ], 'clear: value after';