]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blob - t/20-get.t
Importing Variable-Magic-0.13.tar.gz
[perl/modules/Variable-Magic.git] / t / 20-get.t
1 #!perl -T
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 6;
7
8 use Variable::Magic qw/wizard cast/;
9
10 my $c = 0;
11 my $wiz = wizard get => sub { ++$c };
12 is($c, 0, 'get : create wizard');
13
14 my $n = int rand 1000;
15 my $a = $n;
16
17 cast $a, $wiz;
18 is($c, 0, 'get : cast');
19
20 my $b = $a;
21 is($c, 1,  'get : assign to');
22 is($b, $n, 'get : assign to correctly');
23
24 $b = "X${a}Y";
25 is($c, 2,        'get : interpolate');
26 is($b, "X${n}Y", 'get : interpolate correctly');