]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - t/80-leaks.t
Test destruction of magic callbacks
[perl/modules/Variable-Magic.git] / t / 80-leaks.t
index 0d4075302d0e0a6cfac6457f55a58bb086fe066c..647419f01d6b9ec722984719f7824938a40c7d44 100644 (file)
@@ -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;
+}