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 for my $l (qw(LC_ALL LC_CTYPE LANG)) {
30 skip("cannot easily test under UTF-8 locale", 1)
31 if $ENV{$l} =~ /utf-?8/i;
33 $r = runperl( switches => [ '-CI', '-w' ],
34 prog => 'print ord(<STDIN>)',
37 stdin => "\xC4\x80" );
38 is( $r, 256, '-CI: read in UTF-8 input' );
41 $r = runperl( switches => [ '-CE', '-w' ],
42 prog => 'warn chr(256), qq(\n)',
45 is( $r, "\xC4\x80", '-CE: UTF-8 stderr' );
47 $r = runperl( switches => [ '-Co', '-w' ],
48 prog => 'open(F, q(>out)); print F chr(256); close F',
50 is( $r, '', '-Co: auto-UTF-8 open for output' );
52 push @tmpfiles, "out";
54 $r = runperl( switches => [ '-Ci', '-w' ],
55 prog => 'open(F, q(<out)); print ord(<F>); close F',
57 is( $r, 256, '-Ci: auto-UTF-8 open for input' );
59 $r = runperl( switches => [ '-CA', '-w' ],
60 prog => 'print ord shift',
62 args => [ chr(256) ] );
63 is( $r, 256, '-CA: @ARGV' );