]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - t/21-set.t
This is 0.64
[perl/modules/Variable-Magic.git] / t / 21-set.t
index b81684fdb7eff8b31ed401d2b52d76b0f1398391..70af0e41fc2bfcf173867d243589e112ceeb8d96 100644 (file)
@@ -3,26 +3,35 @@
 use strict;
 use warnings;
 
-use Test::More tests => 2 * 5 + 3 + 1;
+use Test::More tests => (2 * 5 + 3) + (2 * 2 + 1);
 
-use Variable::Magic qw/cast/;
+use Variable::Magic qw<cast>;
 
 use lib 't/lib';
 use Variable::Magic::TestWatcher;
+use Variable::Magic::TestValue;
 
-my $wiz = init 'set', 'set';
+my $wiz = init_watcher 'set', 'set';
 
 my $a = 0;
 
-check { cast $a, $wiz } { }, 'cast';
+watch { cast $a, $wiz } { }, 'cast';
 
 my $n = int rand 1000;
 
-check { $a = $n } { set => 1 }, 'assign';
+watch { $a = $n } { set => 1 }, 'assign';
 is $a, $n, 'set: assign correctly';
 
-check { ++$a } { set => 1 }, 'increment';
+watch { ++$a } { set => 1 }, 'increment';
 is $a, $n + 1, 'set: increment correctly';
 
-check { --$a } { set => 1 }, 'decrement';
+watch { --$a } { set => 1 }, 'decrement';
 is $a, $n, 'set: decrement correctly';
+
+{
+ my $val = 0;
+
+ init_value $val, 'set', 'set';
+
+ value { $val = 1 } \1;
+}