Error message too wide.
[p5sagit/p5-mst-13.2.git] / t / comp / utf.t
CommitLineData
7aa207d6 1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6 unless (find PerlIO::Layer 'perlio') {
7 print "1..0 # Skip: not perlio\n";
8 exit 0;
9 }
10}
11
12require "./test.pl";
13
14plan(tests => 15);
15
16my $BOM = chr(0xFEFF);
17
18sub test {
19 my ($enc, $tag, $bom) = @_;
20 open(UTF_PL, ">:encoding($enc)", "utf.pl")
21 or die "utf.pl($enc,$tag,$bom): $!";
22 print UTF_PL $BOM if $bom;
23 print UTF_PL "$tag\n";
24 close(UTF_PL);
25 my $got = do "./utf.pl";
26 is($got, $tag);
27}
28
29test("utf16le", 123, 1);
30test("utf16le", 1234, 1);
31test("utf16le", 12345, 1);
32test("utf16be", 123, 1);
33test("utf16be", 1234, 1);
34test("utf16be", 12345, 1);
35test("utf8", 123, 1);
36test("utf8", 1234, 1);
37test("utf8", 12345, 1);
38
39test("utf16le", 123, 0);
40test("utf16le", 1234, 0);
41test("utf16le", 12345, 0);
42test("utf16be", 123, 0);
43test("utf16be", 1234, 0);
44test("utf16be", 12345, 0);
45
46END {
47 1 while unlink "utf.pl";
48}