From 56bfefabb6d1291a197aa4b0363ca4a46997e8b9 Mon Sep 17 00:00:00 2001 From: asynts Date: Sun, 27 Sep 2020 18:09:14 +0200 Subject: AK+Format: Keep type information for integers in TypeErasedParameter. It's now save to pass a signed integer as parameter and then use it as replacement field (previously, this would just cast it to size_t which would be bad.) --- AK/Tests/TestFormat.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'AK/Tests/TestFormat.cpp') diff --git a/AK/Tests/TestFormat.cpp b/AK/Tests/TestFormat.cpp index 0336db2c0a..86227f8e16 100644 --- a/AK/Tests/TestFormat.cpp +++ b/AK/Tests/TestFormat.cpp @@ -116,6 +116,9 @@ TEST_CASE(zero_pad) TEST_CASE(replacement_field) { EXPECT_EQ(String::formatted("{:*>{1}}", 13, static_cast(10)), "********13"); + EXPECT_EQ(String::formatted("{:*<{1}}", 7, 4), "7***"); + EXPECT_EQ(String::formatted("{:{2}}", -5, 8, 16), " -5"); + EXPECT_EQ(String::formatted("{{{:*^{1}}}}", 1, 3), "{*1*}"); } TEST_MAIN(Format) -- cgit v1.2.3