diff options
author | Niko Tyni <ntyni@debian.org> | 2010-11-05 13:59:14 +0200 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-11-05 08:38:21 -0700 |
commit | 88770b489c94a85d3383c4ec0452f0c57fc5538a (patch) | |
tree | e9a954807d386c2ed09fd9ee1e0f2c102e8a488c /t/run | |
parent | 20f7624e3fd0a2888bfc8c1fd98f11e603f108e9 (diff) | |
download | perl-88770b489c94a85d3383c4ec0452f0c57fc5538a.tar.gz |
Document that the -Ci, -Co, and -CD options have file scope
While the other -C settings are global, "i" and "o" only affect subsequent
open() calls in the current file. Document this and add two tests to
make sure the documented behaviour doesn't change accidentally.
Diffstat (limited to 't/run')
-rw-r--r-- | t/run/switchC.t | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/t/run/switchC.t b/t/run/switchC.t index 65b5eab17a..b6231ca6d0 100644 --- a/t/run/switchC.t +++ b/t/run/switchC.t @@ -18,11 +18,12 @@ BEGIN { BEGIN { require "./test.pl"; } -plan(tests => 11); +plan(tests => 13); my $r; my $tmpfile = tempfile(); +my $scriptfile = tempfile(); my $b = pack("C*", unpack("U0C*", pack("U",256))); @@ -58,6 +59,20 @@ $r = runperl( switches => [ '-Ci', '-w' ], stderr => 1 ); like( $r, qr/^256(?:\r?\n)?$/s, '-Ci: auto-UTF-8 open for input' ); +open(S, ">$scriptfile") or die("open $scriptfile: $!"); +print S "open(F, q(<$tmpfile)); print ord(<F>); close F"; +close S; + +$r = runperl( switches => [ '-Ci', '-w' ], + progfile => $scriptfile, + stderr => 1 ); +like( $r, qr/^256(?:\r?\n)?$/s, '-Ci: auto-UTF-8 open for input affects the current file' ); + +$r = runperl( switches => [ '-Ci', '-w' ], + prog => "do q($scriptfile)", + stderr => 1 ); +unlike( $r, qr/^256(?:\r?\n)?$/s, '-Ci: auto-UTF-8 open for input has file scope' ); + $r = runperl( switches => [ '-CA', '-w' ], prog => 'print ord shift', stderr => 1, |