diff options
author | asynts <asynts@gmail.com> | 2020-09-29 14:07:39 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-09-29 16:14:58 +0200 |
commit | 1175ecf1dd520262dbb383decedae2cdebfbd0cc (patch) | |
tree | 8600433dd8bd8fb8818be2339f5d834097d6565a /AK/Tests | |
parent | f221a95a7177716335f94cb0ac22b3649d7fbbc5 (diff) | |
download | serenity-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.cpp | 6 |
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) |