]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - t/27-local.t
Switch to qw<>
[perl/modules/Variable-Magic.git] / t / 27-local.t
index 9ecddd6b85878c48470d2bfa83024286c3cd714e..086d619d9a081d7cf8ac79403e26ef83851204de 100644 (file)
@@ -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_watcher 'local', 'local';
 
-{
- local $a;
- ok($c == 1, 'local : localized');
-}
-ok($c == 1, 'local : end of local scope');
+our $a = int rand 1000;
+
+my $res = watch { cast $a, $wiz } { }, 'cast';
+ok $res, 'local: cast succeeded';
+
+watch { local $a } { local => 1 }, 'localized';