summaryrefslogtreecommitdiff
path: root/t/comp
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2004-05-13 00:31:17 +0300
committerNicholas Clark <nick@ccl4.org>2004-05-13 12:15:17 +0000
commit7aa207d6d833e60be59e41514013c4c54b091533 (patch)
treeb4e902ef3fc368d0df17660a87a7fdc432c8025b /t/comp
parent2f8ed50e0f20eccc8aa0c75cdca8c3a23e449ce7 (diff)
downloadperl-7aa207d6d833e60be59e41514013c4c54b091533.tar.gz
BOM-marked and (BOMless) UTF-16 scripts not working
Message-ID: <40A26D75.8080406@iki.fi> Date: Wed, 12 May 2004 21:31:17 +0300 p4raw-id: //depot/perl@22818
Diffstat (limited to 't/comp')
-rw-r--r--t/comp/utf.t48
1 files changed, 48 insertions, 0 deletions
diff --git a/t/comp/utf.t b/t/comp/utf.t
new file mode 100644
index 0000000000..a7b8566932
--- /dev/null
+++ b/t/comp/utf.t
@@ -0,0 +1,48 @@
+#!./perl
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ unless (find PerlIO::Layer 'perlio') {
+ print "1..0 # Skip: not perlio\n";
+ exit 0;
+ }
+}
+
+require "./test.pl";
+
+plan(tests => 15);
+
+my $BOM = chr(0xFEFF);
+
+sub test {
+ my ($enc, $tag, $bom) = @_;
+ open(UTF_PL, ">:encoding($enc)", "utf.pl")
+ or die "utf.pl($enc,$tag,$bom): $!";
+ print UTF_PL $BOM if $bom;
+ print UTF_PL "$tag\n";
+ close(UTF_PL);
+ my $got = do "./utf.pl";
+ is($got, $tag);
+}
+
+test("utf16le", 123, 1);
+test("utf16le", 1234, 1);
+test("utf16le", 12345, 1);
+test("utf16be", 123, 1);
+test("utf16be", 1234, 1);
+test("utf16be", 12345, 1);
+test("utf8", 123, 1);
+test("utf8", 1234, 1);
+test("utf8", 12345, 1);
+
+test("utf16le", 123, 0);
+test("utf16le", 1234, 0);
+test("utf16le", 12345, 0);
+test("utf16be", 123, 0);
+test("utf16be", 1234, 0);
+test("utf16be", 12345, 0);
+
+END {
+ 1 while unlink "utf.pl";
+}