Get the correct refcount on the temporary assignment to PL_sigwarn so
[p5sagit/p5-mst-13.2.git] / t / io / layers.t
index 79800dc..41c44c4 100644 (file)
@@ -41,7 +41,7 @@ if (${^UNICODE} & 1) {
        $UNICODE_STDIN = 1;
     }
 }
-my $NTEST = 43 - (($DOSISH || !$FASTSTDIO) ? 7 : 0) - ($DOSISH ? 5 : 0)
+my $NTEST = 44 - (($DOSISH || !$FASTSTDIO) ? 7 : 0) - ($DOSISH ? 5 : 0)
     + $UNICODE_STDIN;
 
 sub PerlIO::F_UTF8 () { 0x00008000 } # from perliol.h
@@ -212,5 +212,12 @@ SKIP: {
        close G;
     }
 
+    # Check that PL_sigwarn's reference count is correct, and that 
+    # &PerlIO::Layer::NoWarnings isn't prematurely freed.
+    fresh_perl_like (<<'EOT', qr/^CODE/);
+open(UTF, "<:raw:encoding(utf8)", $^X) or die $!;
+print ref *PerlIO::Layer::NoWarnings{CODE};
+EOT
+
     1 while unlink "afile";
 }