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

@ -5,8 +5,8 @@
// https://github.com/bblanchon/ArduinoJson
// If you like this project, please add a star!
#include <gtest/gtest.h>
#include <ArduinoJson.h>
#include <gtest/gtest.h>
class JsonObject_PrettyPrintTo_Tests : public testing::Test {
public:
@ -19,7 +19,7 @@ class JsonObject_PrettyPrintTo_Tests : public testing::Test {
void outputMustBe(const char *expected) {
char buffer[256];
size_t actualLen = _object.prettyPrintTo(buffer, sizeof(buffer));
size_t actualLen = _object.prettyPrintTo(buffer);
size_t measuredLen = _object.measurePrettyLength();
EXPECT_STREQ(expected, buffer);
@ -28,7 +28,9 @@ class JsonObject_PrettyPrintTo_Tests : public testing::Test {
}
};
TEST_F(JsonObject_PrettyPrintTo_Tests, EmptyObject) { outputMustBe("{}"); }
TEST_F(JsonObject_PrettyPrintTo_Tests, EmptyObject) {
outputMustBe("{}");
}
TEST_F(JsonObject_PrettyPrintTo_Tests, OneMember) {
_object["key"] = "value";