Added an printTo(char[N]) and prettyPrintTo(char[N]) (issue #292)

This commit is contained in:
Benoit Blanchon
2016-12-10 15:59:48 +01:00
parent 1f3e227a8b
commit 432476c98a
7 changed files with 31 additions and 12 deletions

View File

@ -15,7 +15,7 @@ class JsonObject_PrintTo_Tests : public testing::Test {
protected:
void outputMustBe(const char *expected) {
char actual[256];
size_t actualLen = _object.printTo(actual, sizeof(actual));
size_t actualLen = _object.printTo(actual);
size_t measuredLen = _object.measureLength();
EXPECT_STREQ(expected, actual);
@ -27,7 +27,9 @@ class JsonObject_PrintTo_Tests : public testing::Test {
JsonObject &_object;
};
TEST_F(JsonObject_PrintTo_Tests, EmptyObject) { outputMustBe("{}"); }
TEST_F(JsonObject_PrintTo_Tests, EmptyObject) {
outputMustBe("{}");
}
TEST_F(JsonObject_PrintTo_Tests, TwoStrings) {
_object["key1"] = "value1";