mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-16 12:02:14 +02:00
Test that now value can be added when all nodes are allocated
This commit is contained in:
@ -75,8 +75,11 @@ JsonNode* JsonObject::getOrCreateNodeAt(char const* key)
|
|||||||
JsonBuffer* buffer = _node->content.asObject.buffer;
|
JsonBuffer* buffer = _node->content.asObject.buffer;
|
||||||
|
|
||||||
JsonNode* newValueNode = buffer->createNode(JSON_UNDEFINED);
|
JsonNode* newValueNode = buffer->createNode(JSON_UNDEFINED);
|
||||||
|
if (!newValueNode) return 0;
|
||||||
|
|
||||||
JsonNode* newKeyNode = buffer->createNode(JSON_KEY);
|
JsonNode* newKeyNode = buffer->createNode(JSON_KEY);
|
||||||
|
if (!newKeyNode) return 0;
|
||||||
|
|
||||||
newKeyNode->content.asKey.key = key;
|
newKeyNode->content.asKey.key = key;
|
||||||
newKeyNode->content.asKey.value = newValueNode;
|
newKeyNode->content.asKey.value = newValueNode;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ protected:
|
|||||||
JsonObject object;
|
JsonObject object;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StaticJsonBuffer<42> json;
|
StaticJsonBuffer<5> json;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(JsonObjectSerializationTests, EmptyObject)
|
TEST_F(JsonObjectSerializationTests, EmptyObject)
|
||||||
@ -80,7 +80,7 @@ TEST_F(JsonObjectSerializationTests, ReplaceExistingKey)
|
|||||||
|
|
||||||
outputMustBe("{\"key\":\"value2\"}");
|
outputMustBe("{\"key\":\"value2\"}");
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
TEST_F(JsonObjectSerializationTests, OneStringOverCapacity)
|
TEST_F(JsonObjectSerializationTests, OneStringOverCapacity)
|
||||||
{
|
{
|
||||||
object["key1"] = "value1";
|
object["key1"] = "value1";
|
||||||
@ -89,7 +89,7 @@ TEST_F(JsonObjectSerializationTests, OneStringOverCapacity)
|
|||||||
|
|
||||||
outputMustBe("{\"key1\":\"value1\",\"key2\":\"value2\"}");
|
outputMustBe("{\"key1\":\"value1\",\"key2\":\"value2\"}");
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
TEST_F(JsonObjectSerializationTests, OneInteger)
|
TEST_F(JsonObjectSerializationTests, OneInteger)
|
||||||
{
|
{
|
||||||
object["key"] = 1;
|
object["key"] = 1;
|
||||||
|
Reference in New Issue
Block a user