add test for change 22209 (Remove small memory leak in newATTRSUB)
authorDave Mitchell <davem@fdisolutions.com>
Sun, 25 Jan 2004 12:00:04 +0000 (12:00 +0000)
committerDave Mitchell <davem@fdisolutions.com>
Sun, 25 Jan 2004 12:00:04 +0000 (12:00 +0000)
p4raw-id: //depot/perl@22215

t/op/closure.t

index f9da311..4d560f6 100755 (executable)
@@ -13,7 +13,7 @@ BEGIN {
 
 use Config;
 
-print "1..186\n";
+print "1..187\n";
 
 my $test = 1;
 sub test (&) {
@@ -678,6 +678,23 @@ __EOF__
     test { $got eq 'ok' };
 }
 
+# After newsub is redefined outside the BEGIN, it's CvOUTSIDE should point
+# to main rather than BEGIN, and BEGIN should be freed.
+
+{
+    my $flag = 0;
+    sub  X::DESTROY { $flag = 1 }
+    {
+       my $x;
+       BEGIN {$x = \&newsub }
+       sub newsub {};
+       $x = bless {}, 'X';
+    }
+    test { $flag == 1 };
+}
+
+
+