OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --icu_case_mapping | 5 // Flags: --icu_case_mapping |
6 | 6 |
7 // Some edge cases that unibrow got wrong | 7 // Some edge cases that unibrow got wrong |
8 | 8 |
9 assertEquals("𐐘", "𐑀".toUpperCase()); | 9 assertEquals("𐐘", "𐑀".toUpperCase()); |
10 assertEquals("𐑀", "𐐘".toLowerCase()); | 10 assertEquals("𐑀", "𐐘".toLowerCase()); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 assertEquals("άόύώ".toLocaleUpperCase([]), | 77 assertEquals("άόύώ".toLocaleUpperCase([]), |
78 "άόύώ".toLocaleUpperCase(Intl.GetDefaultLocale)); | 78 "άόύώ".toLocaleUpperCase(Intl.GetDefaultLocale)); |
79 | 79 |
80 | 80 |
81 // English/root locale keeps U+0307 (combining dot above). | 81 // English/root locale keeps U+0307 (combining dot above). |
82 assertEquals("abci\u0307", "aBcI\u0307".toLocaleLowerCase("en")); | 82 assertEquals("abci\u0307", "aBcI\u0307".toLocaleLowerCase("en")); |
83 assertEquals("abci\u0307", "aBcI\u0307".toLocaleLowerCase(["en", "tr"])); | 83 assertEquals("abci\u0307", "aBcI\u0307".toLocaleLowerCase(["en", "tr"])); |
84 assertEquals("abci\u0307", "aBcI\u0307".toLowerCase()); | 84 assertEquals("abci\u0307", "aBcI\u0307".toLowerCase()); |
85 | 85 |
86 // Greek uppercasing: not covered by intl402/String/*, yet. Tonos (U+0301) and | 86 // Greek uppercasing: not covered by intl402/String/*, yet. Tonos (U+0301) and |
87 // other diacritic marks are dropped. This rule is based on the current CLDR's | 87 // other diacritic marks are dropped. See |
88 // el-Upper transformation, but Greek uppercasing rules are more sophisticated | 88 // http://bugs.icu-project.org/trac/ticket/5456#comment:19 for more examples. |
89 // than this. See http://bugs.icu-project.org/trac/ticket/10582 and | 89 // See also http://bugs.icu-project.org/trac/ticket/12845 . |
90 // http://unicode.org/cldr/trac/ticket/7905 . | |
91 assertEquals("Α", "α\u0301".toLocaleUpperCase("el")); | 90 assertEquals("Α", "α\u0301".toLocaleUpperCase("el")); |
92 assertEquals("Α", "α\u0301".toLocaleUpperCase("el-GR")); | 91 assertEquals("Α", "α\u0301".toLocaleUpperCase("el-GR")); |
93 assertEquals("Α", "α\u0301".toLocaleUpperCase("el-Grek")); | 92 assertEquals("Α", "α\u0301".toLocaleUpperCase("el-Grek")); |
94 assertEquals("Α", "α\u0301".toLocaleUpperCase("el-Grek-GR")); | 93 assertEquals("Α", "α\u0301".toLocaleUpperCase("el-Grek-GR")); |
95 assertEquals("Α", "ά".toLocaleUpperCase("el")); | 94 assertEquals("Α", "ά".toLocaleUpperCase("el")); |
96 assertEquals("ΑΟΥΩ", "άόύώ".toLocaleUpperCase("el")); | 95 assertEquals("ΑΟΫΩ", "άόύώ".toLocaleUpperCase("el")); |
97 assertEquals("ΑΟΥΩ", "α\u0301ο\u0301υ\u0301ω\u0301".toLocaleUpperCase("el")); | 96 assertEquals("ΑΟΫΩ", "α\u0301ο\u0301υ\u0301ω\u0301".toLocaleUpperCase("el")); |
98 assertEquals("ΑΟΥΩ", "άόύώ".toLocaleUpperCase("el")); | 97 assertEquals("ΑΟΫΩ", "άόύώ".toLocaleUpperCase("el")); |
99 assertEquals("ΟΕ", "Ό\u1f15".toLocaleUpperCase("el")); | 98 assertEquals("ΟΕ", "Ό\u1f15".toLocaleUpperCase("el")); |
100 assertEquals("ΟΕ", "Ο\u0301ε\u0314\u0301".toLocaleUpperCase("el")); | 99 assertEquals("ΟΕ", "Ο\u0301ε\u0314\u0301".toLocaleUpperCase("el")); |
| 100 assertEquals("ΡΩΜΕΪΚΑ", "ρωμέικα".toLocaleUpperCase("el")); |
| 101 assertEquals("ΜΑΪΟΥ, ΤΡΟΛΕΪ", "Μαΐου, τρόλεϊ".toLocaleUpperCase("el")); |
| 102 assertEquals("ΤΟ ΕΝΑ Ή ΤΟ ΑΛΛΟ.", "Το ένα ή το άλλο.".toLocaleUpperCase("el")); |
101 | 103 |
102 // Input and output are identical. | 104 // Input and output are identical. |
103 assertEquals("αβγδε", "αβγδε".toLocaleLowerCase("el")); | 105 assertEquals("αβγδε", "αβγδε".toLocaleLowerCase("el")); |
104 assertEquals("ΑΒΓΔΕ", "ΑΒΓΔΕ".toLocaleUpperCase("el")); | 106 assertEquals("ΑΒΓΔΕ", "ΑΒΓΔΕ".toLocaleUpperCase("el")); |
105 assertEquals("ΑΒΓΔΕАБ𝐀𝐁", "ΑΒΓΔΕАБ𝐀𝐁".toLocaleUpperCase("el")); | 107 assertEquals("ΑΒΓΔΕАБ𝐀𝐁", "ΑΒΓΔΕАБ𝐀𝐁".toLocaleUpperCase("el")); |
106 assertEquals("ABCDEÂÓḴ123", "ABCDEÂÓḴ123".toLocaleUpperCase("el")); | 108 assertEquals("ABCDEÂÓḴ123", "ABCDEÂÓḴ123".toLocaleUpperCase("el")); |
107 // ASCII-only or Latin-1 only: 1-byte | 109 // ASCII-only or Latin-1 only: 1-byte |
108 assertEquals("ABCDE123", "ABCDE123".toLocaleUpperCase("el")); | 110 assertEquals("ABCDE123", "ABCDE123".toLocaleUpperCase("el")); |
109 assertEquals("ABCDEÂÓ123", "ABCDEÂÓ123".toLocaleUpperCase("el")); | 111 assertEquals("ABCDEÂÓ123", "ABCDEÂÓ123".toLocaleUpperCase("el")); |
110 | 112 |
(...skipping 18 matching lines...) Expand all Loading... |
129 assertEquals("\u{1D400}\u{1D41A}", "\u{1D400}\u{1D41A}".toUpperCase()); | 131 assertEquals("\u{1D400}\u{1D41A}", "\u{1D400}\u{1D41A}".toUpperCase()); |
130 assertEquals("\u{1D400}\u{1D41A}", "\u{1D400}\u{1D41A}".toLowerCase()); | 132 assertEquals("\u{1D400}\u{1D41A}", "\u{1D400}\u{1D41A}".toLowerCase()); |
131 // Plane 1; New characters in Unicode 8.0 | 133 // Plane 1; New characters in Unicode 8.0 |
132 assertEquals("\u{10C80}", "\u{10CC0}".toUpperCase()); | 134 assertEquals("\u{10C80}", "\u{10CC0}".toUpperCase()); |
133 assertEquals("\u{10CC0}", "\u{10C80}".toLowerCase()); | 135 assertEquals("\u{10CC0}", "\u{10C80}".toLowerCase()); |
134 assertEquals("\u{10C80}", "\u{10CC0}".toLocaleUpperCase()); | 136 assertEquals("\u{10C80}", "\u{10CC0}".toLocaleUpperCase()); |
135 assertEquals("\u{10CC0}", "\u{10C80}".toLocaleLowerCase()); | 137 assertEquals("\u{10CC0}", "\u{10C80}".toLocaleLowerCase()); |
136 assertEquals("\u{10C80}", "\u{10CC0}".toLocaleUpperCase(["tr"])); | 138 assertEquals("\u{10C80}", "\u{10CC0}".toLocaleUpperCase(["tr"])); |
137 assertEquals("\u{10C80}", "\u{10CC0}".toLocaleUpperCase(["tr"])); | 139 assertEquals("\u{10C80}", "\u{10CC0}".toLocaleUpperCase(["tr"])); |
138 assertEquals("\u{10CC0}", "\u{10C80}".toLocaleLowerCase()); | 140 assertEquals("\u{10CC0}", "\u{10C80}".toLocaleLowerCase()); |
OLD | NEW |