X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F80-leaks.t;fp=t%2F80-leaks.t;h=0d4075302d0e0a6cfac6457f55a58bb086fe066c;hb=095bd378aa643e565628144e0a28d31579fab579;hp=dcaf66a3d17727c72bb11f1e49aab93978dfcdba;hpb=068ea108c28a60581d00b44976dc979860832c8e;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/t/80-leaks.t b/t/80-leaks.t index dcaf66a..0d40753 100644 --- a/t/80-leaks.t +++ b/t/80-leaks.t @@ -3,9 +3,9 @@ use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 7; -use Variable::Magic qw/wizard cast/; +use Variable::Magic qw/wizard cast getdata/; our $destroyed; @@ -38,3 +38,30 @@ sub D () { 'Variable::Magic::TestDestructor' } is $destroyed, 1; } + +{ + local $destroyed = 0; + + my $w = wizard data => sub { $_[1] }; + + { + my $copy; + + { + my $obj = D->new; + + { + my $x = 1; + cast $x, $w, $obj; + is $destroyed, 0; + $copy = getdata $x, $w; + } + + is $destroyed, 0; + } + + is $destroyed, 0; + } + + is $destroyed, 1; +}