Add a lot of tests for combinations of values, offsets and lengths
[p5sagit/p5-mst-13.2.git] / t / op / delete.t
index 10a218b..ac4405c 100755 (executable)
@@ -1,6 +1,6 @@
 #!./perl
 
-print "1..36\n";
+print "1..38\n";
 
 # delete() on hash elements
 
@@ -121,3 +121,24 @@ print @{$refary[0]} == 1 ? "ok 35\n" : "not ok 35 @list\n";
     print "not " unless $a == $b && $b == $c;
     print "ok 36\n";
 }
+
+{
+    # [perl #29127] scalar delete of empty slice returned garbage
+    my %h;
+    my ($x,$y) = (1, scalar delete @h{()});
+    print "not " if defined $y;
+    print "ok 37\n";
+}
+
+{
+    # [perl #30733] array delete didn't free returned element
+    my $x = 0;
+    sub X::DESTROY { $x++ }
+    {
+       my @a;
+       $a[0] = bless [], 'X';
+       my $y = delete $a[0];
+    }
+    print "not " unless $x == 1;
+    print "ok 38\n";
+}