This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl.h doesn't need special cases for x2p, as x2p doesn't include it.
[perl5.git] / t / op / method.t
index 8ed3dcf..7332c3c 100644 (file)
@@ -13,7 +13,7 @@ BEGIN {
 use strict;
 no warnings 'once';
 
-plan(tests => 82);
+plan(tests => 83);
 
 @A::ISA = 'B';
 @B::ISA = 'C';
@@ -80,8 +80,8 @@ eval 'no warnings "redefine"; sub B::d {"B::d2"}';    # Import now.
 is(A->d, "B::d2");             # Update hash table;
 
 # What follows is hardly guarantied to work, since the names in scripts
-# are already linked to "pruned" globs. Say, `undef &B::d' if it were
-# after `delete $B::{d}; sub B::d {}' would reach an old subroutine.
+# are already linked to "pruned" globs. Say, 'undef &B::d' if it were
+# after 'delete $B::{d}; sub B::d {}' would reach an old subroutine.
 
 undef &B::d;
 delete $B::{d};
@@ -343,3 +343,13 @@ is $kalled, 1, 'calling a class method via a magic variable';
 
     like(NulTest->${ \"nul\0test" }, "nul\0test", "AUTOLOAD is nul-clean");
 }
+
+
+{
+    fresh_perl_is(
+    q! sub T::DESTROY { $x = $_[0]; } bless [], "T";!,
+    "DESTROY created new reference to dead object 'T' during global destruction.",
+    {},
+       "DESTROY creating a new reference to the object generates a warning."
+    );
+}