summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-03-05 15:58:01 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-03-05 15:58:01 +0000
commit6b6bd37b3c7005ee8dc71fab8f1db43af72cc6ee (patch)
tree1aab5018143091cab7e9b0d3c40b1efbd9b9782c /t
parentfd291da9da05bbb0029f39a9dd45ee4e62fef9a5 (diff)
downloadperl-6b6bd37b3c7005ee8dc71fab8f1db43af72cc6ee.tar.gz
Add tr tests for EBCDIC, from Karsten Sperling.
p4raw-id: //depot/perl@9038
Diffstat (limited to 't')
-rwxr-xr-xt/op/tr.t27
1 files changed, 26 insertions, 1 deletions
diff --git a/t/op/tr.t b/t/op/tr.t
index eb5c4ca27b..e1144641c3 100755
--- a/t/op/tr.t
+++ b/t/op/tr.t
@@ -5,7 +5,7 @@ BEGIN {
@INC = '../lib';
}
-print "1..57\n";
+print "1..61\n";
$_ = "abcdefghijklmnopqrstuvwxyz";
@@ -325,3 +325,28 @@ print "ok 56\n";
print "not " unless $a eq "X";
print "ok 57\n";
+# Tricky on EBCDIC: while [a-z] [A-Z] must not match the gap characters,
+# (i-j, r-s, I-J, R-S), [\x89-\x91] [\xc9-\xd1] has to match them,
+# from Karsten Sperling.
+
+$c = ($a = "\x89\x8a\x8b\x8c\x8d\x8f\x90\x91") =~ tr/\x89-\x91/X/;
+print "not " unless $c == 8 and $a eq "XXXXXXXX";
+print "ok 58\n";
+
+$c = ($a = "\xc9\xca\xcb\xcc\xcd\xcf\xd0\xd1") =~ tr/\xc9-\xd1/X/;
+print "not " unless $c == 8 and $a eq "XXXXXXXX";
+print "ok 59\n";
+
+if (ord('i') == 0x89 & ord('J') == 0xd1) {
+
+$c = ($a = "\x89\x8a\x8b\x8c\x8d\x8f\x90\x91") =~ tr/i-j/X/;
+print "not " unless $c == 2 and $a eq "X\x8a\x8b\x8c\x8d\x8f\x90X";
+print "ok 60\n";
+
+$c = ($a = "\xc9\xca\xcb\xcc\xcd\xcf\xd0\xd1") =~ tr/I-J/X/;
+print "not " unless $c == 2 and $a eq "X\xca\xcb\xcc\xcd\xcf\xd0X";
+print "ok 61\n";
+
+} else {
+ for (60..61) { print "ok $_ # Skip: not EBCDIC\n" }
+}