]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blob - t/24-free.t
Importing Variable-Magic-0.01
[perl/modules/Variable-Magic.git] / t / 24-free.t
1 #!perl -T
2
3 use Test::More tests => 4;
4
5 use Variable::Magic qw/wizard cast/;
6
7 my $c = 0;
8 my $wiz = wizard free => sub { ++$c };
9 ok($c == 0, 'free : create wizard');
10
11 my $n = int rand 1000;
12
13 {
14  my $a = $n;
15
16  cast $a, $wiz;
17  ok($c == 0, 'free : cast');
18 }
19 ok($c == 1, 'free : deletion at the end of the scope');
20
21 my $a = $n;
22 undef $n;
23 ok($c == 1, 'free : explicit deletion with undef()');