forked from bblanchon/ArduinoJson
Fixed assignment of JsonDocument
to JsonVariant
(issue #1023)
This commit is contained in:
@ -108,3 +108,19 @@ TEST_CASE("JsonVariant with not enough memory") {
|
||||
REQUIRE(v.isNull());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("JsonVariant::set(DynamicJsonDocument)") {
|
||||
DynamicJsonDocument doc1(1024);
|
||||
doc1["hello"] = "world";
|
||||
|
||||
DynamicJsonDocument doc2(1024);
|
||||
JsonVariant v = doc2.to<JsonVariant>();
|
||||
|
||||
// Should copy the doc
|
||||
v.set(doc1);
|
||||
doc1.clear();
|
||||
|
||||
std::string json;
|
||||
serializeJson(doc2, json);
|
||||
REQUIRE(json == "{\"hello\":\"world\"}");
|
||||
}
|
||||
|
Reference in New Issue
Block a user