From: Vincent Pit Date: Mon, 30 Nov 2009 20:45:24 +0000 (+0100) Subject: Test destruction of magic callbacks X-Git-Tag: v0.39~4 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FVariable-Magic.git;a=commitdiff_plain;h=4a23afbd13837f7054d2d5e206d207b44cef9e3a Test destruction of magic callbacks --- diff --git a/t/80-leaks.t b/t/80-leaks.t index 0d40753..647419f 100644 --- a/t/80-leaks.t +++ b/t/80-leaks.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 7; +use Test::More tests => 11; use Variable::Magic qw/wizard cast getdata/; @@ -65,3 +65,27 @@ sub D () { 'Variable::Magic::TestDestructor' } is $destroyed, 1; } + +{ + local $destroyed = 0; + + { + my $obj = D->new; + + { + my $w = wizard set => $obj; + + { + my $x = 1; + cast $x, $w; + is $destroyed, 0; + } + + is $destroyed, 0; + } + + is $destroyed, 0; + } + + is $destroyed, 1; +}