subscript.cpp 433 B

12345678910111213141516171819
  1. // ArduinoJson - arduinojson.org
  2. // Copyright Benoit Blanchon 2014-2019
  3. // MIT License
  4. #include <ArduinoJson.h>
  5. #include <catch.hpp>
  6. using namespace ARDUINOJSON_NAMESPACE;
  7. TEST_CASE("MemberProxy::operator[]") {
  8. DynamicJsonDocument doc(4096);
  9. MemberProxy<JsonDocument&, const char*> mp = doc["hello"];
  10. SECTION("set integer") {
  11. mp["world"] = 42;
  12. REQUIRE(doc.as<std::string>() == "{\"hello\":{\"world\":42}}");
  13. }
  14. }