X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F27-local.t;h=650e115e70647969e6dfba78b56742bc16cce2bb;hb=17a9ff0efce08a362dce5b81091f5be3f345251a;hp=27dfd8bc2a9556451ac6f001aff0f1e2a76a2d1e;hpb=18206f59cd87293a083e13340285b1d0c5ad0632;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/t/27-local.t b/t/27-local.t index 27dfd8b..650e115 100644 --- a/t/27-local.t +++ b/t/27-local.t @@ -5,25 +5,22 @@ use warnings; use Test::More; -use Variable::Magic qw/wizard cast MGf_LOCAL/; +use Variable::Magic qw/cast MGf_LOCAL/; if (MGf_LOCAL) { - plan tests => 5; + plan tests => 2 * 3 + 1 + 1; } else { plan skip_all => 'No local magic for this perl'; } -my $c = 0; -my $wiz = wizard 'local' => sub { ++$c }; -is($c, 0, 'local : create wizard'); +use lib 't/lib'; +use Variable::Magic::TestWatcher; -local $a = int rand 1000; -my $res = cast $a, $wiz; -ok($res, 'local : cast succeeded'); -is($c, 0, 'local : cast didn\'t triggered the callback'); +my $wiz = init 'local', 'local'; -{ - local $a; - is($c, 1, 'local : localized'); -} -is($c, 1, 'local : end of local scope'); +our $a = int rand 1000; + +my $res = check { cast $a, $wiz } { }, 'cast'; +ok $res, 'local: cast succeeded'; + +check { local $a } { local => 1 }, 'localized';