1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:14:58 +00:00

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.
This commit is contained in:
Timothy Flynn 2021-09-05 15:09:03 -04:00 committed by Linus Groh
parent 436faf9fd9
commit 50158abaf1
2 changed files with 50 additions and 1 deletions

View file

@ -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