summaryrefslogtreecommitdiff
path: root/t/uni
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-11-24 11:19:22 -0700
committerKarl Williamson <khw@cpan.org>2015-03-05 21:48:28 -0700
commit61900f46d20c06eb5ce7ef3901c4907472310e06 (patch)
tree197633c365c8fcca1efec382f477cc01ce53ce4b /t/uni
parentd6fdb726ca09b2535606ec9b195d4983cbcf80e0 (diff)
downloadperl-61900f46d20c06eb5ce7ef3901c4907472310e06.tar.gz
t/uni/case.pl: Fix to work on non-ASCII platforms
This involves changes to the three test files that call it
Diffstat (limited to 't/uni')
-rw-r--r--t/uni/case.pl15
-rw-r--r--t/uni/lower.t2
-rw-r--r--t/uni/title.t2
-rw-r--r--t/uni/upper.t2
4 files changed, 14 insertions, 7 deletions
diff --git a/t/uni/case.pl b/t/uni/case.pl
index 72de5e86bb..d4bfc07915 100644
--- a/t/uni/case.pl
+++ b/t/uni/case.pl
@@ -5,9 +5,10 @@ BEGIN {
}
use strict;
use warnings;
+use feature 'unicode_strings';
sub unidump {
- join "", map { sprintf "\\x{%04X}", $_ } unpack "U*", $_[0];
+ join "", map { sprintf "\\x{%04X}", $_ } unpack "W*", $_[0];
}
sub casetest {
@@ -52,7 +53,7 @@ sub casetest {
else { # The return is a list of the characters mapped-to.
# prop_invmap() guarantees a single element in the range in
# this case, so no adjustments are needed.
- $spec{$invlist_ref->[$i]} = pack "U0U*" , @{$invmap_ref->[$i]};
+ $spec{$invlist_ref->[$i]} = pack "W*" , @{$invmap_ref->[$i]};
}
}
@@ -73,7 +74,7 @@ sub casetest {
my %none;
for my $i (map { ord } split //,
"\e !\"#\$%&'()+,-./0123456789:;<=>?\@[\\]^_{|}~\b") {
- next if pack("U0U", $i) =~ /\w/;
+ next if pack("W", $i) =~ /\w/;
$none{$i}++ unless $seen{$i};
}
print "# ", scalar keys %none, " noncase mappings\n";
@@ -82,10 +83,10 @@ sub casetest {
my $test = $already_run + 1;
for my $ord (sort keys %simple) {
- my $char = pack "U0U", $ord;
+ my $char = pack "W", $ord;
my $disp_input = unidump($char);
- my $expected = pack("U0U", $simple{$ord});
+ my $expected = pack("W", $simple{$ord});
my $disp_expected = unidump($expected);
foreach my $name (sort keys %funcs) {
@@ -96,7 +97,7 @@ sub casetest {
}
for my $ord (sort keys %spec) {
- my $char = chr($ord); $char .= chr(0x100); chop $char;
+ my $char = pack "W", $ord;
my $disp_input = unidump($char);
my $expected = unidump($spec{$ord});
@@ -109,7 +110,7 @@ sub casetest {
}
for my $ord (sort { $a <=> $b } keys %none) {
- my $char = pack "U0U", $ord;
+ my $char = pack "W", $ord;
my $disp_input = unidump($char);
foreach my $name (sort keys %funcs) {
diff --git a/t/uni/lower.t b/t/uni/lower.t
index 2e6fb2e767..1301b48812 100644
--- a/t/uni/lower.t
+++ b/t/uni/lower.t
@@ -3,6 +3,8 @@ BEGIN {
require "uni/case.pl";
}
+use feature 'unicode_strings';
+
casetest(0, # No extra tests run here,
"Lowercase_Mapping",
lc => sub { lc $_[0] },
diff --git a/t/uni/title.t b/t/uni/title.t
index a043529917..35c4f77de9 100644
--- a/t/uni/title.t
+++ b/t/uni/title.t
@@ -3,6 +3,8 @@ BEGIN {
require "uni/case.pl";
}
+use feature 'unicode_strings';
+
casetest(0, # No extra tests run here,
"Titlecase_Mapping",
ucfirst => sub { ucfirst $_[0] },
diff --git a/t/uni/upper.t b/t/uni/upper.t
index f62b43bfab..41b235ce41 100644
--- a/t/uni/upper.t
+++ b/t/uni/upper.t
@@ -3,6 +3,8 @@ BEGIN {
require "uni/case.pl";
}
+use feature 'unicode_strings';
+
is(uc("\x{3B1}\x{345}\x{301}"), "\x{391}\x{301}\x{399}",
'Verify moves YPOGEGRAMMENI');