Added JsonArray::createNestedObject()

This commit is contained in:
Benoit Blanchon
2014-10-07 15:27:24 +02:00
parent 09b6f71853
commit f7fa9e9467
5 changed files with 34 additions and 24 deletions

View File

@ -6,6 +6,7 @@
#include <gtest/gtest.h>
#include <JsonArray.h>
#include <JsonObject.h>
#include <JsonValue.h>
#include <StaticJsonBuffer.h>
class JsonArray_PrettyPrintTo_Tests : public testing::Test
@ -75,9 +76,8 @@ TEST_F(JsonArray_PrettyPrintTo_Tests, NestedArrays)
nested1.add(1);
nested1.add(2);
JsonArray nested2 = array.createNestedArray();
nested2.add(3);
nested2.add(4);
JsonObject nested2 = array.createNestedObject();
nested2["key"] = 3;
outputMustBe(
"[\r\n"
@ -85,9 +85,8 @@ TEST_F(JsonArray_PrettyPrintTo_Tests, NestedArrays)
" 1,\r\n"
" 2\r\n"
" ],\r\n"
" [\r\n"
" 3,\r\n"
" 4\r\n"
" ]\r\n"
" {\r\n"
" \"key\": 3\r\n"
" }\r\n"
"]");
}