This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make IO::Handle::getline(s) respect the open pragma
[perl5.git] / dist / IO / t / io_utf8argv.t
CommitLineData
986a805c
FC
1#!./perl
2
3BEGIN {
4 unless ($] >= 5.008 and find PerlIO::Layer '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
13
14plan(tests => 2);
15
16open my $fh, ">", 'io_utf8argv';
17print $fh
18 "\xce\x9c\xe1\xbd\xb7\xce\xb1\x20\xcf\x80\xe1\xbd\xb1\xcf\x80\xce".
19 "\xb9\xce\xb1\x2c\x20\xce\xbc\xe1\xbd\xb0\x20\xcf\x80\xce\xbf\xce".
20 "\xb9\xe1\xbd\xb0\x20\xcf\x80\xe1\xbd\xb1\xcf\x80\xce\xb9\xce\xb1".
21 "\xcd\xbe\x0a";
22close $fh or die "close: $!";
23
24
25use open ":std", ":utf8";
26
27use IO::Handle;
28
29@ARGV = ('io_utf8argv') x 2;
30is *ARGV->getline, "Μία πάπια, μὰ ποιὰ πάπια;\n",
31 'getline respects open pragma when magically opening ARGV';
32
33is join('',*ARGV->getlines), "Μία πάπια, μὰ ποιὰ πάπια;\n",
34 'getlines respects open pragma when magically opening ARGV';
35
36END {
37 1 while unlink "io_utf8argv";
38}