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