Re: [perl #36622] y/// at end of file
[p5sagit/p5-mst-13.2.git] / t / op / gv.t
index 655e624..4580473 100755 (executable)
--- a/t/op/gv.t
+++ b/t/op/gv.t
@@ -12,7 +12,7 @@ BEGIN {
 use warnings;
 
 require './test.pl';
-plan( tests => 66 );
+plan( tests => 68 );
 
 # type coersion on assignment
 $foo = 'foo';
@@ -246,6 +246,22 @@ is($j[0], 1);
     is($x, "rocks\n");
 }
 
+{
+    # Need some sort of die or warn to get the global destruction text if the
+    # bug is still present
+    my $output = runperl(prog => <<'EOPROG');
+package M;
+$| = 1;
+sub DESTROY {eval {die qq{Farewell $_[0]}}; print $@}
+package main;
+
+bless \$A::B, 'M';
+*A:: = \*B::;
+EOPROG
+    like($output, qr/^Farewell M=SCALAR/, "DESTROY was called");
+    unlike($output, qr/global destruction/,
+           "unreferenced symbol tables should be cleaned up immediately");
+}
 __END__
 Perl
 Rules