X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fio%2Flayers.t;h=c399b2ad8f5ad05d285803248d0adf4467c7d743;hb=584420f022db57225e9644b9c6668ff9f567984a;hp=659d12de4d71e88bc8172677d4b4f64fa87bb510;hpb=aa45171451213bb4421b11aaca4c2bfe8adeec9d;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/io/layers.t b/t/io/layers.t index 659d12d..c399b2a 100644 --- a/t/io/layers.t +++ b/t/io/layers.t @@ -31,24 +31,33 @@ my $DOSISH = $^O =~ /^(?:MSWin32|os2|dos|NetWare|mint)$/ ? 1 : 0; $DOSISH = 1 if !$DOSISH and $^O =~ /^uwin/; my $NONSTDIO = exists $ENV{PERLIO} && $ENV{PERLIO} ne 'stdio' ? 1 : 0; my $FASTSTDIO = $Config{d_faststdio} && $Config{usefaststdio} ? 1 : 0; -# FIXME. I think that we'll be needing ${^UTF8_LOCALE} -# This is a hack that assumes that no-one will use -C or -C65 (etc) -# without also having a UTF8 locale. Hopefully the smoke tests will pass. -my $UNICODE_STDIN = ${^UNICODE} & 1; -my $NTEST = 43 - (($DOSISH || !$FASTSTDIO) ? 7 : 0) - ($DOSISH ? 5 : 0) - + $UNICODE_STDIN; +my $UTF8_STDIN; +if (${^UNICODE} & 1) { + if (${^UNICODE} & 64) { + # Conditional on the locale + $UTF8_STDIN = ${^UTF8LOCALE}; + } else { + # Unconditional + $UTF8_STDIN = 1; + } +} else { + $UTF8_STDIN = 0; +} +my $NTEST = 44 - (($DOSISH || !$FASTSTDIO) ? 7 : 0) - ($DOSISH ? 5 : 0) + + $UTF8_STDIN; sub PerlIO::F_UTF8 () { 0x00008000 } # from perliol.h plan tests => $NTEST; print <<__EOH__; -# PERLIO = $PERLIO -# DOSISH = $DOSISH -# NONSTDIO = $NONSTDIO -# FASTSTDIO = $FASTSTDIO -# UNICODE = ${^UNICODE} -# UNICODE_STDIN = $UNICODE_STDIN +# PERLIO = $PERLIO +# DOSISH = $DOSISH +# NONSTDIO = $NONSTDIO +# FASTSTDIO = $FASTSTDIO +# UNICODE = ${^UNICODE} +# UTF8LOCALE = ${^UTF8LOCALE} +# UTF8_STDIN = $UTF8_STDIN __EOH__ SKIP: { @@ -113,7 +122,7 @@ SKIP: { } check([ PerlIO::get_layers(STDIN) ], - $UNICODE_STDIN ? [ "stdio", "utf8" ] : [ "stdio" ], + $UTF8_STDIN ? [ "stdio", "utf8" ] : [ "stdio" ], "STDIN"); open(F, ">:crlf", "afile"); @@ -205,5 +214,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)", "afile") or die $!; +print ref *PerlIO::Layer::NoWarnings{CODE}; +EOT + 1 while unlink "afile"; }