mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:47:35 +00:00
AK+LibUnicode: Provide Unicode-aware String titlecase transformation
This commit is contained in:
parent
bc51017a03
commit
d6ddca0c0f
3 changed files with 33 additions and 2 deletions
|
@ -163,6 +163,30 @@ TEST_CASE(to_uppercase)
|
|||
}
|
||||
}
|
||||
|
||||
TEST_CASE(to_titlecase)
|
||||
{
|
||||
{
|
||||
auto string = MUST(String::from_utf8("foo bar baz"sv));
|
||||
auto result = MUST(string.to_titlecase());
|
||||
EXPECT_EQ(result, "Foo Bar Baz"sv);
|
||||
}
|
||||
{
|
||||
auto string = MUST(String::from_utf8("foo \n \r bar \t baz"sv));
|
||||
auto result = MUST(string.to_titlecase());
|
||||
EXPECT_EQ(result, "Foo \n \r Bar \t Baz"sv);
|
||||
}
|
||||
{
|
||||
auto string = MUST(String::from_utf8("f\"oo\" b'ar'"sv));
|
||||
auto result = MUST(string.to_titlecase());
|
||||
EXPECT_EQ(result, "F\"Oo\" B'Ar'"sv);
|
||||
}
|
||||
{
|
||||
auto string = MUST(String::from_utf8("123dollars"sv));
|
||||
auto result = MUST(string.to_titlecase());
|
||||
EXPECT_EQ(result, "123Dollars"sv);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(is_one_of)
|
||||
{
|
||||
auto foo = MUST(String::from_utf8("foo"sv));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue