X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F27-local.t;h=650e115e70647969e6dfba78b56742bc16cce2bb;hb=ed45fb4404201c2e17ffa5c26a2320ceeb132e61;hp=9ecddd6b85878c48470d2bfa83024286c3cd714e;hpb=763ba8093427f3668368fa885741618ac6289d41;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/t/27-local.t b/t/27-local.t index 9ecddd6..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 }; -ok($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'); -ok($c == 0, 'local : cast didn\'t triggered the callback'); +my $wiz = init 'local', 'local'; -{ - local $a; - ok($c == 1, 'local : localized'); -} -ok($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';