Added implicit conversion from JsonArray and JsonObject to JsonVariant

This commit is contained in:
Benoit Blanchon
2018-10-01 12:55:40 +02:00
parent 2d54019f83
commit 29e71cbb16
12 changed files with 220 additions and 191 deletions

View File

@ -205,7 +205,20 @@ TEST_CASE("JsonVariant and strings") {
REQUIRE(variant == "hello");
}
// TODO: string
// TODO: serialized()
}
TEST_CASE("JsonVariant with not enough memory") {
StaticJsonDocument<1> doc;
JsonVariant v = doc.to<JsonVariant>();
SECTION("std::string") {
v.set(std::string("hello"));
REQUIRE(v.isNull());
}
SECTION("Serialized<std::string>") {
v.set(serialized(std::string("hello")));
REQUIRE(v.isNull());
}
}