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

@ -6,6 +6,8 @@
#include <stdint.h>
#include <catch.hpp>
#include "Literals.hpp"
TEST_CASE("JsonVariantConst::containsKey()") {
JsonDocument doc;
doc["hello"] = "world";
@ -17,8 +19,8 @@ TEST_CASE("JsonVariantConst::containsKey()") {
}
SECTION("support std::string") {
REQUIRE(var.containsKey(std::string("hello")) == true);
REQUIRE(var.containsKey(std::string("world")) == false);
REQUIRE(var.containsKey("hello"_s) == true);
REQUIRE(var.containsKey("world"_s) == false);
}
#ifdef HAS_VARIABLE_LENGTH_ARRAY