Re: Regex-Unicode bugs
[p5sagit/p5-mst-13.2.git] / t / op / lc.t
index 18c805f..1fbb3e1 100644 (file)
--- a/t/op/lc.t
+++ b/t/op/lc.t
@@ -1,6 +1,6 @@
 #!./perl
 
-print "1..45\n";
+print "1..51\n";
 
 my $test = 1;
 
@@ -82,14 +82,31 @@ ok(lc($b)         eq "\x{101}\x{101}aa",  'lc');
 # \x{149} is LATIN SMALL LETTER N PRECEDED BY APOSTROPHE, its uppercase is
 # \x{2BC}\x{E4} or MODIFIER LETTER APOSTROPHE and N.
 
-ok("\U\x{DF}ab\x{149}cd" eq "SSAB\x{2BC}NCD",
-   "multicharacter uppercase");
+# In EBCDIC \x{DF} is LATIN SMALL LETTER Y WITH DIAERESIS,
+# and it's uppercase is \x{178}, LATIN CAPITAL LETTER Y WITH DIAERESIS.
+
+if (ord("A") == 193) { # EBCDIC
+    ok("\U\x{DF}aB\x{149}cD" eq "\x{178}AB\x{2BC}NCD",
+       "multicharacter uppercase");
+} elsif (ord("A") == 65) {
+    ok("\U\x{DF}aB\x{149}cD" eq "SSAB\x{2BC}NCD",
+       "multicharacter uppercase");
+} else {
+    ok(0, "what is your encoding?");
+}
 
 # The \x{DF} is its own lowercase, ditto for \x{149}.
 # There are no single character -> multiple characters lowercase mappings.
 
-ok("\L\x{DF}AB\x{149}CD" eq "\x{DF}ab\x{149}cd",
-   "multicharacter lowercase");
+if (ord("A") == 193) { # EBCDIC
+    ok("\LaB\x{149}cD" eq "ab\x{149}cd",
+       "multicharacter lowercase");
+} elsif (ord("A") == 65) {
+    ok("\L\x{DF}aB\x{149}cD" eq "\x{DF}ab\x{149}cd",
+       "multicharacter lowercase");
+} else {
+    ok(0, "what is your encoding?");
+}
 
 # titlecase is used for \u / ucfirst.
 
@@ -106,3 +123,16 @@ ok("\L\x{587}" eq "\x{587}",        "ligature lowercase");
 ok("\u\x{587}" eq "\x{535}\x{582}", "ligature titlecase");
 ok("\U\x{587}" eq "\x{535}\x{552}", "ligature uppercase");
 
+# mktables had problems where many-to-one case mappings didn't work right.
+# The lib/unifold.t should give the fourth folding, "casefolding", a good
+# workout.
+
+ok(lc("\x{1C4}") eq "\x{1C6}",      "U+01C4 lc is U+01C6");
+ok(lc("\x{1C5}") eq "\x{1C6}",      "U+01C5 lc is U+01C6, too");
+
+ok(ucfirst("\x{3C2}") eq "\x{3A3}", "U+03C2 ucfirst is U+03A3");
+ok(ucfirst("\x{3C3}") eq "\x{3A3}", "U+03C3 ucfirst is U+03A3, too");
+
+ok(uc("\x{1C5}") eq "\x{1C4}",      "U+01C5 uc is U+01C4");
+ok(uc("\x{1C6}") eq "\x{1C4}",      "U+01C6 uc is U+01C4, too");
+