]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - t/21-set.t
Test when magic actions take place
[perl/modules/Variable-Magic.git] / t / 21-set.t
index 5ed992fe5577145a14b32aa4d788664308b77c4f..25535e26d026503e64c970e3a236b8cdcadd977d 100644 (file)
@@ -3,12 +3,13 @@
 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 lib 't/lib';
 use Variable::Magic::TestWatcher;
+use Variable::Magic::TestValue;
 
 my $wiz = init_watcher 'set', 'set';
 
@@ -26,3 +27,11 @@ is $a, $n + 1, 'set: increment correctly';
 
 watch { --$a } { set => 1 }, 'decrement';
 is $a, $n, 'set: decrement correctly';
+
+{
+ my $val = 0;
+
+ init_value $val, 'set', 'set';
+
+ value { $val = 1 } \1;
+}