3 # Tests for the command-line switches
8 unless (find PerlIO::Layer 'perlio') {
9 print "1..0 # Skip: not perlio\n";
21 END { unlink @tmpfiles }
23 $r = runperl( switches => [ '-CO', '-w' ],
24 prog => 'print chr(256)',
26 is( $r, "\xC4\x80", '-CO: no warning on UTF-8 output' );
29 if (exists $ENV{PERL_UNICODE} &&
30 ($ENV{PERL_UNICODE} eq "" || $ENV{PERL_UNICODE} =~ /[SO]/)) {
31 skip(qq[cannot test with PERL_UNICODE locale "" or /[SO]/], 1);
33 $r = runperl( switches => [ '-CI', '-w' ],
34 prog => 'print ord(<STDIN>)',
36 stdin => "\xC4\x80" );
37 is( $r, 256, '-CI: read in UTF-8 input' );
40 $r = runperl( switches => [ '-CE', '-w' ],
41 prog => 'warn chr(256), qq(\n)',
44 is( $r, "\xC4\x80", '-CE: UTF-8 stderr' );
46 $r = runperl( switches => [ '-Co', '-w' ],
47 prog => 'open(F, q(>out)); print F chr(256); close F',
49 is( $r, '', '-Co: auto-UTF-8 open for output' );
51 push @tmpfiles, "out";
53 $r = runperl( switches => [ '-Ci', '-w' ],
54 prog => 'open(F, q(<out)); print ord(<F>); close F',
56 is( $r, 256, '-Ci: auto-UTF-8 open for input' );
58 $r = runperl( switches => [ '-CA', '-w' ],
59 prog => 'print ord shift',
61 args => [ chr(256) ] );
62 is( $r, 256, '-CA: @ARGV' );