X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F27-local.t;h=9ecddd6b85878c48470d2bfa83024286c3cd714e;hb=763ba8093427f3668368fa885741618ac6289d41;hp=7d5f88bab4b9685d63ec0045d490aebcca055beb;hpb=6f35a291f0c453d34b617ee9eb03d2a68c410614;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/t/27-local.t b/t/27-local.t index 7d5f88b..9ecddd6 100644 --- a/t/27-local.t +++ b/t/27-local.t @@ -5,34 +5,25 @@ use warnings; use Test::More; -use Variable::Magic qw/wizard cast dispell MGf_LOCAL/; +use Variable::Magic qw/wizard cast MGf_LOCAL/; -if (!MGf_LOCAL) { - plan skip_all => "this perl doesn't handle local magic"; -} else { +if (MGf_LOCAL) { plan tests => 5; +} 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'); -my $n = int rand 1000; -local $a = $n; - -cast $a, $wiz; -ok($c == 0, 'local : cast'); +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'); { local $a; - ok($c == 1, 'local : localize casted variable'); + ok($c == 1, 'local : localized'); } - -dispell $a, $wiz; -ok($c == 1, 'local : dispell'); - -{ - local $a; - ok($c == 1, 'local : localize dispelled variable'); -} - +ok($c == 1, 'local : end of local scope');