]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - t/27-local.t
Importing Variable-Magic-0.08.tar.gz
[perl/modules/Variable-Magic.git] / t / 27-local.t
index 7d5f88bab4b9685d63ec0045d490aebcca055beb..9ecddd6b85878c48470d2bfa83024286c3cd714e 100644 (file)
@@ -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');