mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 09:34:57 +09:00
AK+Everywhere: Fix compiletime format parsing of replacement fields
This commit is contained in:
parent
c0d1a75881
commit
944855ca18
Notes:
sideshowbarker
2024-07-18 17:03:02 +09:00
Author: https://github.com/alimpfard
Commit: 944855ca18
Pull-request: https://github.com/SerenityOS/serenity/pull/7673
Reviewed-by: https://github.com/linusg ✅
3 changed files with 17 additions and 12 deletions
|
@ -105,12 +105,12 @@ TEST_CASE(zero_pad)
|
|||
|
||||
TEST_CASE(replacement_field)
|
||||
{
|
||||
// FIXME: Compiletime check bypass: cannot parse '}}' correctly.
|
||||
EXPECT_EQ(String::formatted(StringView { "{:*>{1}}" }, 13, static_cast<size_t>(10)), "********13");
|
||||
EXPECT_EQ(String::formatted(StringView { "{:*<{1}}" }, 7, 4), "7***");
|
||||
EXPECT_EQ(String::formatted("{:*>{1}}", 13, static_cast<size_t>(10)), "********13");
|
||||
EXPECT_EQ(String::formatted("{:*<{1}}", 7, 4), "7***");
|
||||
// Compiletime check bypass: intentionally ignoring extra arguments
|
||||
EXPECT_EQ(String::formatted(StringView { "{:{2}}" }, -5, 8, 16), " -5");
|
||||
EXPECT_EQ(String::formatted(StringView { "{{{:*^{1}}}}" }, 1, 3), "{*1*}");
|
||||
EXPECT_EQ(String::formatted(StringView { "{:0{}}" }, 1, 3), "001");
|
||||
EXPECT_EQ(String::formatted("{{{:*^{1}}}}", 1, 3), "{*1*}");
|
||||
EXPECT_EQ(String::formatted("{:0{}}", 1, 3), "001");
|
||||
}
|
||||
|
||||
TEST_CASE(replacement_field_regression)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue