diff options
author | Nicholas Clark <nick@ccl4.org> | 2004-03-09 16:11:37 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2004-03-09 16:11:37 +0000 |
commit | 6aa2f6a7a4e2a0d061a689b227dcf063d93806a6 (patch) | |
tree | b1cdce1b0005b1331cebe2ac1c775d48ea999b01 /t | |
parent | 821bf9a5d89e1fc44be0165540e1f57de5c874e1 (diff) | |
download | perl-6aa2f6a7a4e2a0d061a689b227dcf063d93806a6.tar.gz |
Make a temporary copy of the input buffer in pp_send, so that send
and syswrite don't gratuitously upgrade their input to UTF8
p4raw-id: //depot/perl@22471
Diffstat (limited to 't')
-rwxr-xr-x | t/op/sysio.t | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/t/op/sysio.t b/t/op/sysio.t index 473a3f0883..435be12efb 100755 --- a/t/op/sysio.t +++ b/t/op/sysio.t @@ -1,8 +1,9 @@ #!./perl -print "1..39\n"; +print "1..42\n"; chdir('op') || chdir('t/op') || die "sysio.t: cannot look for myself: $!"; +@INC = '../../lib'; open(I, 'sysio.t') || die "sysio.t: cannot find myself: $!"; @@ -213,6 +214,29 @@ close(I); unlink $outfile; +# Check that utf8 IO doesn't upgrade the scalar +open(I, ">$outfile") || die "sysio.t: cannot write $outfile: $!"; +# Will skip harmlessly on stdioperl +eval {binmode STDOUT, ":utf8"}; +die $@ if $@ and $@ !~ /^IO layers \(like ':utf8'\) unavailable/; + +# y diaresis is \w when UTF8 +$a = chr 255; + +print $a =~ /\w/ ? "not ok 40\n" : "ok 40\n"; + +syswrite I, $a; + +# Should not be upgraded as a side effect of syswrite. +print $a =~ /\w/ ? "not ok 41\n" : "ok 41\n"; + +# This should work +eval {syswrite I, 2;}; +print $@ eq "" ? "ok 42\n" : "not ok 42 # $@"; + +close(I); +unlink $outfile; + chdir('..'); 1; |