Remove a warning against unsafe signals in perlipc.pod,
[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 }
ec721aa4 10 if ($ENV{PERL_CORE_MINITEST}) {
11 print "1..0 # Skip: no dynamic loading on miniperl, no threads\n";
12 exit 0;
13 }
7aa207d6 14}
15
16require "./test.pl";
17
18plan(tests => 15);
19
20my $BOM = chr(0xFEFF);
21
22sub test {
23 my ($enc, $tag, $bom) = @_;
ed45ef62 24 open(UTF_PL, ">:raw:encoding($enc)", "utf.pl")
7aa207d6 25 or die "utf.pl($enc,$tag,$bom): $!";
26 print UTF_PL $BOM if $bom;
27 print UTF_PL "$tag\n";
28 close(UTF_PL);
29 my $got = do "./utf.pl";
30 is($got, $tag);
31}
32
33test("utf16le", 123, 1);
34test("utf16le", 1234, 1);
35test("utf16le", 12345, 1);
36test("utf16be", 123, 1);
37test("utf16be", 1234, 1);
38test("utf16be", 12345, 1);
39test("utf8", 123, 1);
40test("utf8", 1234, 1);
41test("utf8", 12345, 1);
42
43test("utf16le", 123, 0);
44test("utf16le", 1234, 0);
45test("utf16le", 12345, 0);
46test("utf16be", 123, 0);
47test("utf16be", 1234, 0);
48test("utf16be", 12345, 0);
49
50END {
51 1 while unlink "utf.pl";
52}