]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - t/80-leaks.t
This is 0.53
[perl/modules/Variable-Magic.git] / t / 80-leaks.t
index dcaf66a3d17727c72bb11f1e49aab93978dfcdba..7b2a3f0ed51d44ec3ddd9d6a693104cb907a1b8e 100644 (file)
@@ -3,9 +3,9 @@
 use strict;
 use warnings;
 
-use Test::More tests => 3;
+use Test::More tests => 11;
 
-use Variable::Magic qw/wizard cast/;
+use Variable::Magic qw<wizard cast getdata>;
 
 our $destroyed;
 
@@ -38,3 +38,54 @@ 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;
+}
+
+{
+ 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;
+}