From: Jarkko Hietaniemi Date: Sun, 18 Nov 2001 16:16:17 +0000 (+0000) Subject: Add test for sysread(). X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=003a51c12003a23e8a5f07e66eb9bceafa71af29;p=p5sagit%2Fp5-mst-13.2.git Add test for sysread(). p4raw-id: //depot/perl@13073 --- diff --git a/t/io/utf8.t b/t/io/utf8.t index d973a2a..96ea58e 100755 --- a/t/io/utf8.t +++ b/t/io/utf8.t @@ -12,7 +12,7 @@ BEGIN { no utf8; # needed for use utf8 not griping about the raw octets $| = 1; -print "1..26\n"; +print "1..27\n"; open(F,"+>:utf8",'a'); print F chr(0x100).'£'; @@ -210,4 +210,22 @@ for (@a) { close F; print "ok 26\n"; +open F, "<:utf8", "a"; +$a = 0; +for (@a) { + unless (sysread(F, $b, 1) == 1 && + length($b) == 1 && + ord($b) == ord($_) && + tell(F) == ($a += bytes::length($b))) { + print '# ord($_) == ', ord($_), "\n"; + print '# ord($b) == ', ord($b), "\n"; + print '# length($b) == ', length($b), "\n"; + print '# tell(F) == ', tell(F), "\n"; + print "not "; + last; + } +} +close F; +print "ok 27\n"; + END { 1 while unlink "a" }