Changed the array subscript to automatically add missing elements

This commit is contained in:
Benoit Blanchon
2020-02-20 08:59:25 +01:00
parent 0001dabfd1
commit d8724e0a0b
24 changed files with 209 additions and 93 deletions

View File

@ -43,3 +43,11 @@ TEST_CASE("JsonDocument automatically promotes to object") {
REQUIRE(doc["one"]["two"]["three"] == 4);
}
TEST_CASE("JsonDocument automatically promotes to array") {
DynamicJsonDocument doc(4096);
doc[2] = 2;
REQUIRE(doc.as<std::string>() == "[null,null,2]");
}