X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F23-clear.t;h=a3aad82ded0d9e07f14c90ac9ab46600e07163ab;hb=b9df7824d4619174e28f9b1b5856c4a228d9cc7b;hp=3f7f57e7ed8d0928b4a5db1c36aa65ad93352ea7;hpb=da422089a9a5dfbf84e72ec3ba867063471ff41c;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/t/23-clear.t b/t/23-clear.t index 3f7f57e..a3aad82 100644 --- a/t/23-clear.t +++ b/t/23-clear.t @@ -3,12 +3,13 @@ use strict; use warnings; -use Test::More tests => 2 * 5 + 2 + 1; +use Test::More tests => (2 * 5 + 2) + (2 * 2 + 1) + 1; -use Variable::Magic qw/cast/; +use Variable::Magic qw/cast dispell/; use lib 't/lib'; use Variable::Magic::TestWatcher; +use Variable::Magic::TestValue; my $wiz = init_watcher 'clear', 'clear'; @@ -25,3 +26,14 @@ watch { cast %h, $wiz } { }, 'cast hash'; watch { %h = () } { clear => 1 }, 'clear hash'; is_deeply \%h, { }, 'clear: clear hash correctly'; + +{ + my @val = (4 .. 6); + + my $wv = init_value @val, 'clear', 'clear'; + + value { @val = () } [ 4 .. 6 ]; + + dispell @val, $wv; + is_deeply \@val, [ ], 'clear: value after'; +}