From: Vincent Pit Date: Sun, 18 Jan 2009 15:46:32 +0000 (+0100) Subject: Convert t/27-local.t to the new testing framework X-Git-Tag: v0.27~12 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=17a9ff0efce08a362dce5b81091f5be3f345251a;p=perl%2Fmodules%2FVariable-Magic.git Convert t/27-local.t to the new testing framework --- 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';