Tests: add user-defined literal ""_s for std::string

This commit is contained in:
Benoit Blanchon
2024-06-07 09:35:45 +02:00
parent 5b88b2c1f6
commit 45611924f3
55 changed files with 316 additions and 229 deletions

View File

@ -5,6 +5,8 @@
#include <ArduinoJson.h>
#include <catch.hpp>
#include "Literals.hpp"
TEST_CASE("JsonObjectConst::containsKey()") {
JsonDocument doc;
doc["hello"] = 42;
@ -16,8 +18,8 @@ TEST_CASE("JsonObjectConst::containsKey()") {
}
SECTION("supports std::string") {
REQUIRE(false == obj.containsKey(std::string("world")));
REQUIRE(true == obj.containsKey(std::string("hello")));
REQUIRE(false == obj.containsKey("world"_s));
REQUIRE(true == obj.containsKey("hello"_s));
}
#ifdef HAS_VARIABLE_LENGTH_ARRAY