summaryrefslogtreecommitdiff
path: root/AK/Tests
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2020-09-29 14:07:39 +0200
committerAndreas Kling <kling@serenityos.org>2020-09-29 16:14:58 +0200
commit1175ecf1dd520262dbb383decedae2cdebfbd0cc (patch)
tree8600433dd8bd8fb8818be2339f5d834097d6565a /AK/Tests
parentf221a95a7177716335f94cb0ac22b3649d7fbbc5 (diff)
downloadserenity-1175ecf1dd520262dbb383decedae2cdebfbd0cc.zip
AK+Format: Add support for integer to character casts.
Now the following is possible: outf("{:c}", 75); // K
Diffstat (limited to 'AK/Tests')
-rw-r--r--AK/Tests/TestFormat.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/AK/Tests/TestFormat.cpp b/AK/Tests/TestFormat.cpp
index 18994250fd..fa26f0caf2 100644
--- a/AK/Tests/TestFormat.cpp
+++ b/AK/Tests/TestFormat.cpp
@@ -130,4 +130,10 @@ TEST_CASE(complex_string_specifiers)
EXPECT_EQ(String::formatted("{:^9}", "abcd"), " abcd ");
}
+TEST_CASE(cast_integer_to_character)
+{
+ EXPECT_EQ(String::formatted("{:c}", static_cast<int>('a')), "a");
+ EXPECT_EQ(String::formatted("{:c}", static_cast<unsigned int>('f')), "f");
+}
+
TEST_MAIN(Format)