summaryrefslogtreecommitdiff
path: root/lib/feature
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-05-26 20:34:06 -0600
committerKarl Williamson <khw@cpan.org>2014-05-31 10:08:19 -0600
commit6deb7a5e3707524fd23c0080d6a762ff30e50494 (patch)
tree7dbc0f10f4184d131c021750cb3cda92c6a5f741 /lib/feature
parenta08d8f37be94aca8ba15add2c576382bb9f818c4 (diff)
downloadperl-6deb7a5e3707524fd23c0080d6a762ff30e50494.tar.gz
Use already existing functions in some .t files
I invented 2 functions for use in .t files a while back that turn out to be duplicates of (undocumented) functions that already existed suitable for general use. This commit changes to use those general functions and removes the copies from t/test.pl. (I plan to document these functions later in 5.21.). This is in preparation for moving some similar functions from t/test.pl to a newly created test tools file, as it turns out that these functions are useful in .t files that don't use t/test.pl, but instead, e.g., Test::More.
Diffstat (limited to 'lib/feature')
-rw-r--r--lib/feature/unicode_strings.t42
1 files changed, 21 insertions, 21 deletions
diff --git a/lib/feature/unicode_strings.t b/lib/feature/unicode_strings.t
index 8bd536f258..ce3f22579e 100644
--- a/lib/feature/unicode_strings.t
+++ b/lib/feature/unicode_strings.t
@@ -30,8 +30,8 @@ my @posix_to_lower
# Override the elements in the to_lower arrays that have different standard
# lower case mappings. (standard meaning they are 32 numbers apart)
for my $i (0x41 .. 0x5A, 0xC0 .. 0xD6, 0xD8 .. 0xDE) {
- my $upper_ord = ord_latin1_to_native $i;
- my $lower_ord = ord_latin1_to_native($i + 32);
+ my $upper_ord = utf8::unicode_to_native $i;
+ my $lower_ord = utf8::unicode_to_native($i + 32);
$latin1_to_lower[$upper_ord] = chr($lower_ord);
@@ -42,8 +42,8 @@ for my $i (0x41 .. 0x5A, 0xC0 .. 0xD6, 0xD8 .. 0xDE) {
# Same for upper and title
for my $i (0x61 .. 0x7A, 0xE0 .. 0xF6, 0xF8 .. 0xFE) {
- my $lower_ord = ord_latin1_to_native $i;
- my $upper_ord = ord_latin1_to_native($i - 32);
+ my $lower_ord = utf8::unicode_to_native $i;
+ my $upper_ord = utf8::unicode_to_native($i - 32);
$latin1_to_upper[$lower_ord] = chr($upper_ord);
$latin1_to_title[$lower_ord] = chr($upper_ord);
@@ -55,12 +55,12 @@ for my $i (0x61 .. 0x7A, 0xE0 .. 0xF6, 0xF8 .. 0xFE) {
}
# Override the abnormal cases.
-$latin1_to_upper[ord_latin1_to_native 0xB5] = chr(0x39C);
-$latin1_to_title[ord_latin1_to_native 0xB5] = chr(0x39C);
-$latin1_to_upper[ord_latin1_to_native 0xDF] = 'SS';
-$latin1_to_title[ord_latin1_to_native 0xDF] = 'Ss';
-$latin1_to_upper[ord_latin1_to_native 0xFF] = chr(0x178);
-$latin1_to_title[ord_latin1_to_native 0xFF] = chr(0x178);
+$latin1_to_upper[utf8::unicode_to_native 0xB5] = chr(0x39C);
+$latin1_to_title[utf8::unicode_to_native 0xB5] = chr(0x39C);
+$latin1_to_upper[utf8::unicode_to_native 0xDF] = 'SS';
+$latin1_to_title[utf8::unicode_to_native 0xDF] = 'Ss';
+$latin1_to_upper[utf8::unicode_to_native 0xFF] = chr(0x178);
+$latin1_to_title[utf8::unicode_to_native 0xFF] = chr(0x178);
my $repeat = 25; # Length to make strings.
@@ -74,8 +74,8 @@ $cyrillic{'uc'} = chr(0x42F) x $repeat;
$cyrillic{'lc'} = chr(0x44F) x $repeat;
my %latin1;
-$latin1{'uc'} = chr(ord_latin1_to_native 0xD8) x $repeat;
-$latin1{'lc'} = chr(ord_latin1_to_native 0xF8) x $repeat;
+$latin1{'uc'} = chr(utf8::unicode_to_native 0xD8) x $repeat;
+$latin1{'lc'} = chr(utf8::unicode_to_native 0xF8) x $repeat;
my %empty;
$empty{'lc'} = $empty{'uc'} = "";
@@ -165,19 +165,19 @@ for my $i ( 0x30 .. 0x39, # 0-9
0xF8 .. 0xFF, # various
)
{
- $w[ord_latin1_to_native $i] = 1;
+ $w[utf8::unicode_to_native $i] = 1;
}
# Boolean: is s[$i] a \s character?
my @s = (0) x 256;
-$s[ord_latin1_to_native 0x09] = 1; # Tab
-$s[ord_latin1_to_native 0x0A] = 1; # LF
-$s[ord_latin1_to_native 0x0B] = 1; # VT
-$s[ord_latin1_to_native 0x0C] = 1; # FF
-$s[ord_latin1_to_native 0x0D] = 1; # CR
-$s[ord_latin1_to_native 0x20] = 1; # SPACE
-$s[ord_latin1_to_native 0x85] = 1; # NEL
-$s[ord_latin1_to_native 0xA0] = 1; # NO BREAK SPACE
+$s[utf8::unicode_to_native 0x09] = 1; # Tab
+$s[utf8::unicode_to_native 0x0A] = 1; # LF
+$s[utf8::unicode_to_native 0x0B] = 1; # VT
+$s[utf8::unicode_to_native 0x0C] = 1; # FF
+$s[utf8::unicode_to_native 0x0D] = 1; # CR
+$s[utf8::unicode_to_native 0x20] = 1; # SPACE
+$s[utf8::unicode_to_native 0x85] = 1; # NEL
+$s[utf8::unicode_to_native 0xA0] = 1; # NO BREAK SPACE
for my $i (0 .. 255) {
my $char = chr($i);