From: Vincent Pit Date: Mon, 30 Nov 2009 20:22:10 +0000 (+0100) Subject: Also test getdata() in t/80-leaks.t X-Git-Tag: v0.39~5 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FVariable-Magic.git;a=commitdiff_plain;h=095bd378aa643e565628144e0a28d31579fab579 Also test getdata() in t/80-leaks.t --- 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; +}