From 50158abaf196e23e5996646bfc1b42f8ca0d3764 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sun, 5 Sep 2021 15:09:03 -0400 Subject: LibUnicode: Implement locale-aware BEFORE_DOT special casing Note that the algorithm in the Unicode spec is for checking that a code point precedes U+0307, but the special casing condition NotBeforeDot is interested in the inverse of this rule. --- Tests/LibUnicode/TestUnicodeCharacterTypes.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'Tests') diff --git a/Tests/LibUnicode/TestUnicodeCharacterTypes.cpp b/Tests/LibUnicode/TestUnicodeCharacterTypes.cpp index e53b951945..c20f0e4849 100644 --- a/Tests/LibUnicode/TestUnicodeCharacterTypes.cpp +++ b/Tests/LibUnicode/TestUnicodeCharacterTypes.cpp @@ -243,6 +243,29 @@ TEST_CASE(to_unicode_lowercase_special_casing_more_above) EXPECT_EQ(result, "\u012f\u0307\u0300"sv); } +TEST_CASE(to_unicode_lowercase_special_casing_not_before_dot) +{ + // LATIN CAPITAL LETTER I + auto result = Unicode::to_unicode_lowercase_full("I"sv, "en"sv); + EXPECT_EQ(result, "i"sv); + + result = Unicode::to_unicode_lowercase_full("I"sv, "az"sv); + EXPECT_EQ(result, "\u0131"sv); + + result = Unicode::to_unicode_lowercase_full("I"sv, "tr"sv); + EXPECT_EQ(result, "\u0131"sv); + + // LATIN CAPITAL LETTER I followed by COMBINING DOT ABOVE + result = Unicode::to_unicode_lowercase_full("I\u0307"sv, "en"sv); + EXPECT_EQ(result, "i\u0307"sv); + + result = Unicode::to_unicode_lowercase_full("I\u0307"sv, "az"sv); + EXPECT_EQ(result, "i"sv); + + result = Unicode::to_unicode_lowercase_full("I\u0307"sv, "tr"sv); + EXPECT_EQ(result, "i"sv); +} + TEST_CASE(to_unicode_uppercase_unconditional_special_casing) { // LATIN SMALL LETTER SHARP S -- cgit v1.2.3