mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 16:14:05 +01:00
Ignore write to member
This commit is contained in:
@@ -72,4 +72,11 @@ TEST_CASE("Linked document") {
|
|||||||
SECTION("get member") {
|
SECTION("get member") {
|
||||||
CHECK(variant["hello"].as<std::string>() == "world");
|
CHECK(variant["hello"].as<std::string>() == "world");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("set member") {
|
||||||
|
// The link is read-only; the following line should have no side effect
|
||||||
|
variant["tutu"] = "toto";
|
||||||
|
|
||||||
|
CHECK(doc1.as<std::string>() == "{\"hello\":\"world\"}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ class VariantData {
|
|||||||
TStoragePolicy storage_policy) {
|
TStoragePolicy storage_policy) {
|
||||||
if (isNull())
|
if (isNull())
|
||||||
toObject();
|
toObject();
|
||||||
if (!isObject())
|
if (!isObjectStrict())
|
||||||
return 0;
|
return 0;
|
||||||
return _content.asCollection.getOrAddMember(key, pool, storage_policy);
|
return _content.asCollection.getOrAddMember(key, pool, storage_policy);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user