cast.cpp 356 B

123456789101112131415161718
  1. // ArduinoJson - https://arduinojson.org
  2. // Copyright © 2014-2022, Benoit BLANCHON
  3. // MIT License
  4. #include <ArduinoJson.h>
  5. #include <catch.hpp>
  6. #include <string>
  7. TEST_CASE("Implicit cast to JsonVariant") {
  8. StaticJsonDocument<128> doc;
  9. doc["hello"] = "world";
  10. JsonVariant var = doc;
  11. CHECK(var.as<std::string>() == "{\"hello\":\"world\"}");
  12. }