Be more explicit on the List::Util build trick,
[p5sagit/p5-mst-13.2.git] / ext / PerlIO / PerlIO.t
CommitLineData
ec28694c 1BEGIN {
2 chdir 't' if -d 't';
3 @INC = '../lib';
4 require Config; import Config;
dc87d25e 5 unless ($Config{'useperlio'}) {
6 print "1..0 # Skip: PerlIO not used\n";
ec28694c 7 exit 0;
8 }
9}
10
11use PerlIO;
12
13print "1..19\n";
14
15print "ok 1\n";
16
17my $txt = "txt$$";
18my $bin = "bin$$";
19my $utf = "utf$$";
20
21my $txtfh;
22my $binfh;
23my $utffh;
24
25print "not " unless open($txtfh, ">:crlf", $txt);
26print "ok 2\n";
27
28print "not " unless open($binfh, ">:raw", $bin);
29print "ok 3\n";
30
31print "not " unless open($utffh, ">:utf8", $utf);
32print "ok 4\n";
33
34print $txtfh "foo\n";
35print $txtfh "bar\n";
36print "not " unless close($txtfh);
37print "ok 5\n";
38
39print $binfh "foo\n";
40print $binfh "bar\n";
41print "not " unless close($binfh);
42print "ok 6\n";
43
44print $utffh "foo\x{ff}\n";
45print $utffh "bar\x{abcd}\n";
46print "not " unless close($utffh);
47print "ok 7\n";
48
49print "not " unless open($txtfh, "<:crlf", $txt);
50print "ok 8\n";
51
52print "not " unless open($binfh, "<:raw", $bin);
53print "ok 9\n";
54
55print "not " unless open($utffh, "<:utf8", $utf);
56print "ok 10\n";
57
58print "not " unless <$txtfh> eq "foo\n" && <$txtfh> eq "bar\n";
59print "ok 11\n";
60
61print "not " unless <$binfh> eq "foo\n" && <$binfh> eq "bar\n";
62print "ok 12\n";
63
64print "not " unless <$utffh> eq "foo\x{ff}\n" && <$utffh> eq "bar\x{abcd}\n";
65print "ok 13\n";
66
67print "not " unless eof($txtfh);
68print "ok 14\n";
69
70print "not " unless eof($binfh);
71print "ok 15\n";
72
73print "not " unless eof($utffh);
74print "ok 16\n";
75
76print "not " unless close($txtfh);
77print "ok 17\n";
78
79print "not " unless close($binfh);
80print "ok 18\n";
81
82print "not " unless close($utffh);
83print "ok 19\n";
84
85END {
86 1 while unlink $txt;
87 1 while unlink $bin;
88 1 while unlink $utf;
89}
90