summaryrefslogtreecommitdiff
path: root/t/test.pl
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2010-12-16 10:38:09 -0700
committerKarl Williamson <public@khwilliamson.com>2010-12-16 10:40:04 -0700
commitec0363d9bb05a67dad10a50c9b76b5aba365199a (patch)
treedf9cdba141dff210c4433659f6eac0f245887f8a /t/test.pl
parent20f15c4187eac900e8420667a1591aa1a78ab45d (diff)
downloadperl-ec0363d9bb05a67dad10a50c9b76b5aba365199a.tar.gz
test.pl: extend EBCDIC functions to beyond 255
Allow the functions to handle non-latin1 input. This would only show up on EBCDIC platforms.
Diffstat (limited to 't/test.pl')
-rw-r--r--t/test.pl15
1 files changed, 10 insertions, 5 deletions
diff --git a/t/test.pl b/t/test.pl
index 5f8eb987fc..b58013df77 100644
--- a/t/test.pl
+++ b/t/test.pl
@@ -1142,16 +1142,21 @@ sub latin1_to_native($) {
}
sub ord_latin1_to_native {
- # given an input latin1 code point, return the platform's native
- # equivalent value
+ # given an input code point, return the platform's native
+ # equivalent value. Anything above latin1 is itself.
- return ord latin1_to_native(chr $_[0]);
+ my $ord = shift;
+ return $ord if $ord > 255;
+ return ord latin1_to_native(chr $ord);
}
sub ord_native_to_latin1 {
- # given an input platform code point, return the latin1 equivalent value
+ # given an input platform code point, return the latin1 equivalent value.
+ # Anything above latin1 is itself.
- return ord native_to_latin1(chr $_[0]);
+ my $ord = shift;
+ return $ord if $ord > 255;
+ return ord native_to_latin1(chr $ord);
}
1;