summaryrefslogtreecommitdiff
path: root/AK/Tests/TestFormat.cpp
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2020-09-27 18:09:14 +0200
committerAndreas Kling <kling@serenityos.org>2020-09-28 10:53:16 +0200
commit56bfefabb6d1291a197aa4b0363ca4a46997e8b9 (patch)
tree5d58456cca621479c317a0411e374bdb8a579d88 /AK/Tests/TestFormat.cpp
parent6a2f5f45226fd3979fac7deedca8b61618f09749 (diff)
downloadserenity-56bfefabb6d1291a197aa4b0363ca4a46997e8b9.zip
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.)
Diffstat (limited to 'AK/Tests/TestFormat.cpp')
-rw-r--r--AK/Tests/TestFormat.cpp3
1 files changed, 3 insertions, 0 deletions
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<size_t>(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)