This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: Smoke [5.9.2] 22818 FAIL(F) MSWin32 WinXP/.Net SP1 (x86/1 cpu)
[perl5.git] / t / comp / utf.t
CommitLineData
7aa207d6
JH
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) = @_;
ed45ef62 20 open(UTF_PL, ">:raw:encoding($enc)", "utf.pl")
7aa207d6
JH
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}