Add test for sysread().
authorJarkko Hietaniemi <jhi@iki.fi>
Sun, 18 Nov 2001 16:16:17 +0000 (16:16 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Sun, 18 Nov 2001 16:16:17 +0000 (16:16 +0000)
p4raw-id: //depot/perl@13073

t/io/utf8.t

index d973a2a..96ea58e 100755 (executable)
@@ -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" }