get.cpp 454 B

12345678910111213141516171819
  1. // ArduinoJson - arduinojson.org
  2. // Copyright Benoit Blanchon 2014-2023
  3. // MIT License
  4. #include <ArduinoJson.h>
  5. #include <catch.hpp>
  6. using namespace Catch::Matchers;
  7. TEST_CASE("JsonObject::get()") {
  8. DynamicJsonBuffer jb;
  9. JsonObject& obj = jb.createObject();
  10. SECTION("GetConstCharPointer_GivenStringLiteral") {
  11. obj.set("hello", "world");
  12. const char* value = obj.get<const char*>("hello");
  13. REQUIRE_THAT(value, Equals("world"));
  14. }
  15. }