]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blob - t/21-set.t
Convert t/21-set.t to the new testing framework
[perl/modules/Variable-Magic.git] / t / 21-set.t
1 #!perl -T
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 2 * 5 + 3 + 1;
7
8 use Variable::Magic qw/cast/;
9
10 use lib 't/lib';
11 use Variable::Magic::TestWatcher;
12
13 my $wiz = init 'set', 'set';
14
15 my $a = 0;
16
17 check { cast $a, $wiz } { }, 'cast';
18
19 my $n = int rand 1000;
20
21 check { $a = $n } { set => 1 }, 'assign';
22 is $a, $n, 'set: assign correctly';
23
24 check { ++$a } { set => 1 }, 'increment';
25 is $a, $n + 1, 'set: increment correctly';
26
27 check { --$a } { set => 1 }, 'decrement';
28 is $a, $n, 'set: decrement correctly';