mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:47:44 +00:00
LibC+Tests: Fix broken snprintf test.
`snprintf` returns the number of characters that would have been written had the buffer been large enough. It's a common trick to call `snprintf(nullptr, 0, ...)` to measure how large a buffer has to be. Thus the return value is not zero but fourteen.
This commit is contained in:
parent
0ab3488b60
commit
a5f5c3fd33
1 changed files with 1 additions and 1 deletions
|
@ -155,7 +155,7 @@ TEST_CASE(too_long)
|
|||
TEST_CASE(special_cases)
|
||||
{
|
||||
EXPECT(test_single({ LITERAL(""), "Hello Friend!", POISON, 13, LITERAL("") }));
|
||||
EXPECT_EQ(snprintf(nullptr, 0, "Hello, friend!"), 0);
|
||||
EXPECT_EQ(snprintf(nullptr, 0, "Hello, friend!"), 14);
|
||||
EXPECT(test_single({ LITERAL(""), "", POISON, 0, LITERAL("") }));
|
||||
EXPECT(test_single({ LITERAL("x"), "", POISON, 0, LITERAL("\0") }));
|
||||
EXPECT(test_single({ LITERAL("xx"), "", POISON, 0, LITERAL("\0x") }));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue