]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - t/21-set.t
Convert t/21-set.t to the new testing framework
[perl/modules/Variable-Magic.git] / t / 21-set.t
index 095b482c6499d8b4e28fcf0c24fb20f821e36ade..b81684fdb7eff8b31ed401d2b52d76b0f1398391 100644 (file)
@@ -3,27 +3,26 @@
 use strict;
 use warnings;
 
-use Test::More tests => 8;
+use Test::More tests => 2 * 5 + 3 + 1;
 
-use Variable::Magic qw/wizard cast/;
+use Variable::Magic qw/cast/;
 
-my $c = 0;
-my $wiz = wizard set => sub { ++$c };
-is($c, 0, 'get : create wizard');
+use lib 't/lib';
+use Variable::Magic::TestWatcher;
+
+my $wiz = init 'set', 'set';
 
 my $a = 0;
-cast $a, $wiz;
-is($c, 0, 'get : cast');
+
+check { cast $a, $wiz } { }, 'cast';
 
 my $n = int rand 1000;
-$a = $n;
-is($c, 1,  'set : assign');
-is($a, $n, 'set : assign correctly');
 
-++$a;
-is($c, 2,      'set : increment');
-is($a, $n + 1, 'set : increment correctly');
+check { $a = $n } { set => 1 }, 'assign';
+is $a, $n, 'set: assign correctly';
+
+check { ++$a } { set => 1 }, 'increment';
+is $a, $n + 1, 'set: increment correctly';
 
---$a;
-is($c, 3,  'set : decrement');
-is($a, $n, 'set : decrement correctly');
+check { --$a } { set => 1 }, 'decrement';
+is $a, $n, 'set: decrement correctly';