diff options
author | asynts <asynts@gmail.com> | 2020-10-02 15:21:30 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-10-02 20:48:19 +0200 |
commit | 6351a56d275714205be721ec192c0b98b4f917f3 (patch) | |
tree | ce2ed22f91ad7a0302029989c89a5994544ccf16 /AK/Tests/TestFormat.cpp | |
parent | ac5e08a541409bc47766be5196f5bec3140339dd (diff) | |
download | serenity-6351a56d275714205be721ec192c0b98b4f917f3.zip |
AK+Format: Do some housekeeping in the format implementation.
Diffstat (limited to 'AK/Tests/TestFormat.cpp')
-rw-r--r-- | AK/Tests/TestFormat.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/AK/Tests/TestFormat.cpp b/AK/Tests/TestFormat.cpp index 2441303e6d..fca71b7451 100644 --- a/AK/Tests/TestFormat.cpp +++ b/AK/Tests/TestFormat.cpp @@ -162,4 +162,22 @@ TEST_CASE(pointers) } } +// If the format implementation did absolutely nothing, all tests would pass. This +// is because when a test fails we only write "FAIL" to stdout using format. +// +// This is a bit scary, thus this test. At least this test should fail in this case. +TEST_CASE(ensure_that_format_works) +{ + + if (String::formatted("FAIL") != "FAIL") { + fprintf(stderr, "FAIL\n"); + exit(1); + } + + if (String::formatted("{} FAIL {}", 1, 2) != "1 FAIL 2") { + fprintf(stderr, "FAIL\n"); + exit(1); + } +} + TEST_MAIN(Format) |