]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blob - t/10-simple.t
Importing Variable-Magic-0.01
[perl/modules/Variable-Magic.git] / t / 10-simple.t
1 #!perl -T
2
3 use Test::More tests => 12;
4
5 use Variable::Magic qw/wizard gensig getsig cast dispell/;
6
7 my $sig = gensig;
8
9 my $wiz = eval { wizard sig => $sig };
10 ok(!$@, "wizard creation error ($@)");
11 ok(defined $wiz, 'wizard is defined');
12 ok(ref $wiz eq 'SCALAR', 'wizard is a scalar ref');
13 ok($sig == getsig $wiz, 'wizard signature is correct');
14
15 my $a = 0;
16 my $res = eval { cast $a, $wiz };
17 ok(!$@, "cast error 1 ($@)");
18 ok($res, 'cast error 2');
19
20 $res = eval { dispell $a, $wiz };
21 ok(!$@, "dispell from wizard error 1 ($@)");
22 ok($res, 'dispell from wizard error 2');
23
24 $res = eval { cast $a, $wiz };
25 ok(!$@, "re-cast error 1 ($@)");
26 ok($res, 're-cast error 2');
27
28 $res = eval { dispell $a, $sig };
29 ok(!$@, "dispell from signature error 1 ($@)");
30 ok($res, 'dispell from signature error 2');
31