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