forked from bblanchon/ArduinoJson
Clear the JsonObject or JsonArray in deserializeJson()
This commit is contained in:
1 parent
cf149940ed
commit
0d1623edef
15 files changed
+126
-9
No files matched your search
@@ -66,4 +66,15 @@ TEST_CASE("deserializeJson(StaticJsonObject&)") {
|
||||
|
||||
REQUIRE(err != JsonError::Ok);
|
||||
}
|
||||
|
||||
SECTION("Should clear the JsonObject") {
|
||||
StaticJsonObject<JSON_OBJECT_SIZE(1)> obj;
|
||||
char input[] = "{\"hello\":\"world\"}";
|
||||
|
||||
deserializeJson(obj, input);
|
||||
deserializeJson(obj, "{}");
|
||||
|
||||
REQUIRE(obj.size() == 0);
|
||||
REQUIRE(obj.memoryUsage() == JSON_OBJECT_SIZE(0));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user