mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
AK+Format: Make it possible to format string literals as pointers.
String literals are just pointers to a constant character. It should be possible to format them as such. (The default is to print them as strings still.)
This commit is contained in:
parent
7c2cd81edb
commit
d2ca7ca017
2 changed files with 28 additions and 13 deletions
|
@ -182,4 +182,10 @@ TEST_CASE(ensure_that_format_works)
|
|||
}
|
||||
}
|
||||
|
||||
TEST_CASE(format_string_literal_as_pointer)
|
||||
{
|
||||
const char* literal = "abc";
|
||||
EXPECT_EQ(String::formatted("{:p}", literal), String::formatted("{:p}", reinterpret_cast<FlatPtr>(literal)));
|
||||
}
|
||||
|
||||
TEST_MAIN(Format)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue