forked from bblanchon/ArduinoJson
1 parent
dd1d96e28f
commit
d92eee8736
22 files changed
+263
-269
No files matched your search
@@ -7,7 +7,6 @@ add_executable(JsonVariantTests
|
||||
as.cpp
|
||||
clear.cpp
|
||||
compare.cpp
|
||||
containsKey.cpp
|
||||
converters.cpp
|
||||
copy.cpp
|
||||
is.cpp
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
// ArduinoJson - https://arduinojson.org
|
||||
// Copyright © 2014-2024, Benoit BLANCHON
|
||||
// MIT License
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include <stdint.h>
|
||||
#include <catch.hpp>
|
||||
|
||||
#include "Literals.hpp"
|
||||
|
||||
TEST_CASE("JsonVariant::containsKey()") {
|
||||
JsonDocument doc;
|
||||
JsonVariant var = doc.to<JsonVariant>();
|
||||
|
||||
SECTION("containsKey(const char*)") {
|
||||
var["hello"] = "world";
|
||||
|
||||
REQUIRE(var.containsKey("hello") == true);
|
||||
REQUIRE(var.containsKey("world") == false);
|
||||
}
|
||||
|
||||
SECTION("containsKey(std::string)") {
|
||||
var["hello"] = "world";
|
||||
|
||||
REQUIRE(var.containsKey("hello"_s) == true);
|
||||
REQUIRE(var.containsKey("world"_s) == false);
|
||||
}
|
||||
|
||||
SECTION("containsKey(JsonVariant)") {
|
||||
var["hello"] = "world";
|
||||
var["key"] = "hello";
|
||||
|
||||
REQUIRE(var.containsKey(doc["key"]) == true);
|
||||
REQUIRE(var.containsKey(doc["foo"]) == false);
|
||||
}
|
||||
}
|
||||
@@ -73,10 +73,6 @@ TEST_CASE("Unbound JsonVariant") {
|
||||
CHECK_FALSE(variant["key"_s].set(1));
|
||||
}
|
||||
|
||||
SECTION("containsKey()") {
|
||||
CHECK_FALSE(variant.containsKey("hello"));
|
||||
}
|
||||
|
||||
SECTION("remove()") {
|
||||
variant.remove(0);
|
||||
variant.remove("hello");
|
||||
|
||||
Reference in new issue
Block a user