summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorSimon Cozens <simon@netthink.co.uk>2000-10-29 19:36:48 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-10-29 21:00:47 +0000
commit89491803eada141bfe112702c189849c457eac87 (patch)
tree701fe90c1f6d9cd3d308f33706c76eeccda86114 /t
parent39ca283eb96f3f63e2aa42b33b559e2ab96b0231 (diff)
downloadperl-89491803eada141bfe112702c189849c457eac87.tar.gz
Make \x{...} consistently produce UTF-8.
Subject: Re: \x{...} is confused Message-ID: <20001029193648.A6287@pembro4.pmb.ox.ac.uk> p4raw-id: //depot/perl@7485
Diffstat (limited to 't')
-rwxr-xr-xt/pragma/utf8.t86
1 files changed, 80 insertions, 6 deletions
diff --git a/t/pragma/utf8.t b/t/pragma/utf8.t
index 768da05846..93a5bc4595 100755
--- a/t/pragma/utf8.t
+++ b/t/pragma/utf8.t
@@ -10,7 +10,7 @@ BEGIN {
}
}
-print "1..181\n";
+print "1..191\n";
my $test = 1;
@@ -326,11 +326,16 @@ sub nok_bytes {
{
# bug id 20001009.001
- my($a,$b);
- { use bytes; $a = "\xc3\xa4"; }
- { use utf8; $b = "\xe4"; }
- { use bytes; ok_bytes $a, $b; $test++; } # 69
- { use utf8; nok $a, $b; $test++; } # 70
+ my ($a, $b);
+
+ { use bytes; $a = "\xc3\xa4" }
+ { use utf8; $b = "\xe4" } # \xXX must not produce UTF-8
+
+ print "not " if $a eq $b;
+ print "ok $test\n"; $test++;
+
+ { use utf8; print "not " if $a eq $b; }
+ print "ok $test\n"; $test++;
}
{
@@ -726,3 +731,72 @@ __EOMK__
}
}
+{
+ # tests 182..191
+
+ {
+ my $a = "\x{41}";
+
+ print "not " unless length($a) == 1;
+ print "ok $test\n";
+ $test++;
+
+ use bytes;
+ print "not " unless $a eq "\x41" && length($a) == 1;
+ print "ok $test\n";
+ $test++;
+ }
+
+ {
+ my $a = "\x{80}";
+
+ print "not " unless length($a) == 1;
+ print "ok $test\n";
+ $test++;
+
+ use bytes;
+ print "not " unless $a eq "\xc2\x80" && length($a) == 2;
+ print "ok $test\n";
+ $test++;
+ }
+
+ {
+ my $a = "\x{100}";
+
+ print "not " unless length($a) == 1;
+ print "ok $test\n";
+ $test++;
+
+ use bytes;
+ print "not " unless $a eq "\xc4\x80" && length($a) == 2;
+ print "ok $test\n";
+ $test++;
+ }
+
+ {
+ my $a = "\x{100}\x{80}";
+
+ print "not " unless length($a) == 2;
+ print "ok $test\n";
+ $test++;
+
+ use bytes;
+ print "not " unless $a eq "\xc4\x80\xc2\x80" && length($a) == 4;
+ print "ok $test\n";
+ $test++;
+ }
+
+ {
+ my $a = "\x{80}\x{100}";
+
+ print "not " unless length($a) == 2;
+ print "ok $test\n";
+ $test++;
+
+ use bytes;
+ print "not " unless $a eq "\xc2\x80\xc4\x80" && length($a) == 4;
+ print "ok $test\n";
+ $test++;
+ }
+}
+