1#!./perl 2 3BEGIN { 4 unless ( PerlIO::Layer->find('perlio') ) { 5 print "1..0 # Skip: not perlio\n"; 6 exit 0; 7 } 8 require($ENV{PERL_CORE} ? "../../t/test.pl" : "./t/test.pl"); 9} 10 11use utf8; 12 13skip_all("EBCDIC platform; testing not core") 14 if $::IS_EBCDIC && ! $ENV{PERL_CORE}; 15 16plan(tests => 4); 17 18my $bytes = 19 "\xce\x9c\xe1\xbd\xb7\xce\xb1\x20\xcf\x80\xe1\xbd\xb1\xcf\x80\xce". 20 "\xb9\xce\xb1\x2c\x20\xce\xbc\xe1\xbd\xb0\x20\xcf\x80\xce\xbf\xce". 21 "\xb9\xe1\xbd\xb0\x20\xcf\x80\xe1\xbd\xb1\xcf\x80\xce\xb9\xce\xb1". 22 "\xcd\xbe\x0a"; 23 24if ($::IS_EBCDIC) { 25 require($ENV{PERL_CORE} ? "../../t/charset_tools.pl" : "./t/charset_tools.pl"); 26 $bytes = byte_utf8a_to_utf8n($bytes) 27} 28 29open my $fh, ">:raw", 'io_utf8argv'; 30print $fh $bytes; 31close $fh or die "close: $!"; 32 33 34use IO::Handle; 35 36SKIP: { 37 skip("PERL_UNICODE set", 2) 38 if exists $ENV{PERL_UNICODE}; 39 40 @ARGV = ('io_utf8argv') x 2; 41 is *ARGV->getline, $bytes, 42 'getline (no open pragma) when magically opening ARGV'; 43 44 is join('',*ARGV->getlines), $bytes, 45 'getlines (no open pragma) when magically opening ARGV'; 46} 47 48use open ":std", ":utf8"; 49 50@ARGV = ('io_utf8argv') x 2; 51is *ARGV->getline, "Μία πάπια, μὰ ποιὰ πάπια;\n", 52 'getline respects open pragma when magically opening ARGV'; 53 54is join('',*ARGV->getlines), "Μία πάπια, μὰ ποιὰ πάπια;\n", 55 'getlines respects open pragma when magically opening ARGV'; 56 57END { 58 1 while unlink "io_utf8argv"; 59} 60