serializeMsgPack(doc, p, n) doesn't add terminator anymore (fixes #1545)

This commit is contained in:
Benoit Blanchon
2021-04-29 20:59:15 +02:00
parent 337864618c
commit 2be528a3fa
11 changed files with 47 additions and 20 deletions

View File

@ -39,15 +39,15 @@ void common_tests(StringWriter& sb, const String& output) {
}
TEST_CASE("StaticStringWriter") {
char output[20];
char output[20] = {0};
StaticStringWriter sb(output, sizeof(output));
common_tests(sb, static_cast<const char*>(output));
SECTION("OverCapacity") {
REQUIRE(19 == print(sb, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
REQUIRE(20 == print(sb, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
REQUIRE(0 == print(sb, "ABC"));
REQUIRE(std::string("ABCDEFGHIJKLMNOPQRS") == output);
REQUIRE("ABCDEFGHIJKLMNOPQRST" == std::string(output, 20));
}
}