mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-16 12:02:14 +02:00
Clear the JsonObject or JsonArray in deserializeJson()
This commit is contained in:
@ -76,4 +76,15 @@ TEST_CASE("deserializeJson(StaticJsonArray&)") {
|
||||
// note: we use a string of 8 bytes to be sure that the StaticJsonBuffer
|
||||
// will not insert bytes to enforce alignement
|
||||
}
|
||||
|
||||
SECTION("Should clear the JsonArray") {
|
||||
StaticJsonArray<JSON_ARRAY_SIZE(4)> arr;
|
||||
char input[] = "[1,2,3,4]";
|
||||
|
||||
deserializeJson(arr, input);
|
||||
deserializeJson(arr, "[]");
|
||||
|
||||
REQUIRE(arr.size() == 0);
|
||||
REQUIRE(arr.memoryUsage() == JSON_ARRAY_SIZE(0));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user