Change 18779 by [EMAIL PROTECTED] on 2003/02/25 18:20:01

        Add tests for the -C switch.  Depending on the
        CLIs some $^O dance may be needed.

Affected files ...

... //depot/perl/MANIFEST#985 edit
... //depot/perl/t/run/switchC.t#1 add

Differences ...

==== //depot/perl/MANIFEST#985 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST#984~18774~    Tue Feb 25 05:21:19 2003
+++ perl/MANIFEST       Tue Feb 25 10:20:01 2003
@@ -2697,6 +2697,7 @@
 t/run/noswitch.t               Test aliasing ARGV for other switch tests
 t/run/runenv.t                 Test if perl honors its environment variables.
 t/run/switcha.t                        Test the -a switch
+t/run/switchC.t                        Test the -C switch
 t/run/switches.t               Tests for the other switches
 t/run/switchF.t                        Test the -F switch
 t/run/switchI.t                        Test the -I switch

==== //depot/perl/t/run/switchC.t#1 (text) ====
Index: perl/t/run/switchC.t
--- /dev/null   Tue May  5 13:32:27 1998
+++ perl/t/run/switchC.t        Tue Feb 25 10:20:01 2003
@@ -0,0 +1,57 @@
+#!./perl -w
+
+# Tests for the command-line switches
+
+BEGIN {
+    chdir 't' if -d 't';
+    @INC = '../lib';
+    unless (find PerlIO::Layer 'perlio') {
+       print "1..0 # Skip: not perlio\n";
+       exit 0;
+    }
+}
+
+require "./test.pl";
+
+plan(tests => 6);
+
+my $r;
+
+my @tmpfiles = ();
+END { unlink @tmpfiles }
+
+$r = runperl( switches => [ '-CO', '-w' ],
+             prog     => 'print chr(256)',
+              stderr   => 1 );
+is( $r, "\xC4\x80", '-CO: no warning on UTF-8 output' );
+
+$r = runperl( switches => [ '-CI', '-w' ],
+             prog     => 'print ord(<STDIN>)',
+              stderr   => 1,
+             stdin    => chr(256) );
+is( $r, 256, '-CI: read in UTF-8 output' );
+
+$r = runperl( switches => [ '-CE', '-w' ],
+             prog     => 'warn chr(256), qq(\n)',
+              stderr   => 1 );
+chomp $r;
+is( $r, "\xC4\x80", '-CE: UTF-8 stderr' );
+
+$r = runperl( switches => [ '-Co', '-w' ],
+             prog     => 'open(F, q(>out)); print F chr(256); close F',
+              stderr   => 1 );
+is( $r, '', '-Co: auto-UTF-8 open for output' );
+
+push @tmpfiles, "out";
+
+$r = runperl( switches => [ '-Ci', '-w' ],
+             prog     => 'open(F, q(<out)); print ord(<F>); close F',
+              stderr   => 1 );
+is( $r, 256, '-Ci: auto-UTF-8 open for input' );
+
+$r = runperl( switches => [ '-CA', '-w' ],
+             prog     => 'print ord shift',
+              stderr   => 1,
+              args     => [ chr(256) ] );
+is( $r, 256, '-CA: @ARGV' );
+
End of Patch.

Reply via email to