Add JsonVariant::link()

This commit is contained in:
Benoit Blanchon
2022-03-10 13:50:01 +01:00
parent bf5d0c790c
commit f5cf7a8a20
28 changed files with 705 additions and 52 deletions

View File

@@ -23,4 +23,15 @@ TEST_CASE("JsonVariant::clear()") {
REQUIRE(var.isNull() == true);
}
SECTION("doesn't alter linked object") {
StaticJsonDocument<128> doc2;
doc2["hello"] = "world";
var.link(doc2);
var.clear();
CHECK(var.isNull() == true);
CHECK(doc2.as<std::string>() == "{\"hello\":\"world\"}");
}
}