mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-17 07:50:04 +00:00
AK: Add a basic formatter for wchar_t
This commit is contained in:
parent
4ef3ed4ba3
commit
67a579aab0
Notes:
sideshowbarker
2024-07-18 03:09:55 +09:00
Author: https://github.com/timschumi
Commit: 67a579aab0
Pull-request: https://github.com/SerenityOS/serenity/pull/10170
Reviewed-by: https://github.com/BertalanD ✅
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/IdanHo
Reviewed-by: https://github.com/kleinesfilmroellchen
3 changed files with 31 additions and 0 deletions
|
@ -323,3 +323,17 @@ TEST_CASE(vector_format)
|
|||
EXPECT_EQ(String::formatted("{}", v), "[ [ 1, 2 ], [ 3, 4 ] ]");
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(format_wchar)
|
||||
{
|
||||
EXPECT_EQ(String::formatted("{}", L'a'), "a");
|
||||
EXPECT_EQ(String::formatted("{}", L'\U0001F41E'), "\xF0\x9F\x90\x9E");
|
||||
EXPECT_EQ(String::formatted("{:x}", L'a'), "61");
|
||||
EXPECT_EQ(String::formatted("{:x}", L'\U0001F41E'), "1f41e");
|
||||
EXPECT_EQ(String::formatted("{:d}", L'a'), "97");
|
||||
EXPECT_EQ(String::formatted("{:d}", L'\U0001F41E'), "128030");
|
||||
|
||||
EXPECT_EQ(String::formatted("{:6}", L'a'), "a ");
|
||||
EXPECT_EQ(String::formatted("{:6d}", L'a'), " 97");
|
||||
EXPECT_EQ(String::formatted("{:#x}", L'\U0001F41E'), "0x1f41e");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue