Make write() (i.e. formats) utf8-aware by calling do_print() rather
[p5sagit/p5-mst-13.2.git] / t / io / utf8.t
CommitLineData
7d59b7e4 1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6 require Config; import Config;
7 unless ($Config{'useperlio'}) {
8 print "1..0 # Skip: not perlio\n";
9 exit 0;
10 }
11}
12
13$| = 1;
14print "1..11\n";
15
16open(F,"+>:utf8",'a');
17print F chr(0x100).'£';
18print '#'.tell(F)."\n";
19print "not " unless tell(F) == 4;
20print "ok 1\n";
21print F "\n";
22print '#'.tell(F)."\n";
23print "not " unless tell(F) >= 5;
24print "ok 2\n";
25seek(F,0,0);
26print "not " unless getc(F) eq chr(0x100);
27print "ok 3\n";
28print "not " unless getc(F) eq "£";
29print "ok 4\n";
30print "not " unless getc(F) eq "\n";
31print "ok 5\n";
32seek(F,0,0);
33binmode(F,":bytes");
34print "not " unless getc(F) eq chr(0xc4);
35print "ok 6\n";
36print "not " unless getc(F) eq chr(0x80);
37print "ok 7\n";
38print "not " unless getc(F) eq chr(0xc2);
39print "ok 8\n";
40print "not " unless getc(F) eq chr(0xa3);
41print "ok 9\n";
42print "not " unless getc(F) eq "\n";
43print "ok 10\n";
44seek(F,0,0);
45binmode(F,":utf8");
46print "not " unless scalar(<F>) eq "\x{100}£\n";
47print "ok 11\n";
48close(F);
49
50# unlink('a');
51