mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Renamed undocumented function isUndefined() to isUnbound()
				
					
				
			This commit is contained in:
		| @@ -17,7 +17,7 @@ add_executable(JsonArrayTests | ||||
| 	size.cpp | ||||
| 	std_string.cpp | ||||
| 	subscript.cpp | ||||
| 	undefined.cpp | ||||
| 	unbound.cpp | ||||
| ) | ||||
|  | ||||
| add_test(JsonArray JsonArrayTests) | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
| 
 | ||||
| using namespace Catch::Matchers; | ||||
| 
 | ||||
| TEST_CASE("Undefined JsonArray") { | ||||
| TEST_CASE("Unbound JsonArray") { | ||||
|   JsonArray array; | ||||
| 
 | ||||
|   SECTION("SubscriptFails") { | ||||
| @@ -22,7 +22,7 @@ add_executable(JsonVariantTests | ||||
| 	set.cpp | ||||
| 	subscript.cpp | ||||
| 	types.cpp | ||||
| 	undefined.cpp | ||||
| 	unbound.cpp | ||||
| ) | ||||
|  | ||||
| add_test(JsonVariant JsonVariantTests) | ||||
|   | ||||
| @@ -89,7 +89,7 @@ TEST_CASE("JsonVariant::set(JsonVariant)") { | ||||
|  | ||||
|     unboundVariant.set(var1); | ||||
|  | ||||
|     REQUIRE(unboundVariant.isUndefined()); | ||||
|     REQUIRE(unboundVariant.isUnbound()); | ||||
|     REQUIRE(unboundVariant.isNull()); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -11,7 +11,7 @@ TEST_CASE("JsonVariant::is<T>()") { | ||||
|   DynamicJsonDocument doc(4096); | ||||
|   JsonVariant variant = doc.to<JsonVariant>(); | ||||
|  | ||||
|   SECTION("undefined") { | ||||
|   SECTION("unbound") { | ||||
|     variant = JsonVariant(); | ||||
|  | ||||
|     CHECK(variant.is<JsonObject>() == false); | ||||
| @@ -168,7 +168,7 @@ TEST_CASE("JsonVariantConst::is<T>()") { | ||||
|   JsonVariant variant = doc.to<JsonVariant>(); | ||||
|   JsonVariantConst cvariant = variant; | ||||
|  | ||||
|   SECTION("undefined") { | ||||
|   SECTION("unbound") { | ||||
|     cvariant = JsonVariantConst(); | ||||
|  | ||||
|     CHECK(cvariant.is<JsonArray>() == false); | ||||
|   | ||||
| @@ -9,30 +9,30 @@ TEST_CASE("JsonVariant::operator|()") { | ||||
|   DynamicJsonDocument doc(4096); | ||||
|   JsonVariant variant = doc["value"].to<JsonVariant>(); | ||||
|  | ||||
|   SECTION("undefined") { | ||||
|     SECTION("undefined | const char*") { | ||||
|   SECTION("null") { | ||||
|     SECTION("null | const char*") { | ||||
|       std::string result = variant | "default"; | ||||
|       REQUIRE(result == "default"); | ||||
|     } | ||||
|  | ||||
|     SECTION("undefined | int") { | ||||
|     SECTION("null | int") { | ||||
|       int result = variant | 42; | ||||
|       REQUIRE(result == 42); | ||||
|     } | ||||
|  | ||||
|     SECTION("undefined | bool") { | ||||
|     SECTION("null | bool") { | ||||
|       bool result = variant | true; | ||||
|       REQUIRE(result == true); | ||||
|     } | ||||
|  | ||||
|     SECTION("undefined | ElementProxy") { | ||||
|     SECTION("null | ElementProxy") { | ||||
|       doc["array"][0] = 42; | ||||
|  | ||||
|       JsonVariantConst result = variant | doc["array"][0]; | ||||
|       REQUIRE(result == 42); | ||||
|     } | ||||
|  | ||||
|     SECTION("undefined | MemberProxy") { | ||||
|     SECTION("null | MemberProxy") { | ||||
|       doc["other"] = 42; | ||||
|  | ||||
|       JsonVariantConst result = variant | doc["other"]; | ||||
|   | ||||
| @@ -9,7 +9,7 @@ TEST_CASE("JsonVariant::operator[]") { | ||||
|   DynamicJsonDocument doc(4096); | ||||
|   JsonVariant var = doc.to<JsonVariant>(); | ||||
|  | ||||
|   SECTION("The JsonVariant is undefined") { | ||||
|   SECTION("The JsonVariant is null") { | ||||
|     REQUIRE(0 == var.size()); | ||||
|     REQUIRE(var["0"].isNull()); | ||||
|     REQUIRE(var[0].isNull()); | ||||
| @@ -136,7 +136,7 @@ TEST_CASE("JsonVariantConst::operator[]") { | ||||
|   JsonVariant var = doc.to<JsonVariant>(); | ||||
|   JsonVariantConst cvar = var; | ||||
|  | ||||
|   SECTION("The JsonVariant is undefined") { | ||||
|   SECTION("The JsonVariant is null") { | ||||
|     REQUIRE(0 == cvar.size()); | ||||
|     REQUIRE(cvar["0"].isNull()); | ||||
|     REQUIRE(cvar[0].isNull()); | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| #include <ArduinoJson.h> | ||||
| #include <catch.hpp> | ||||
| 
 | ||||
| TEST_CASE("JsonVariant undefined") { | ||||
| TEST_CASE("Unbound JsonVariant") { | ||||
|   JsonVariant variant; | ||||
| 
 | ||||
|   SECTION("as<T>()") { | ||||
| @@ -31,7 +31,7 @@ static void checkVariant(T value, const std::string& expected) { | ||||
| } | ||||
|  | ||||
| TEST_CASE("serialize MsgPack value") { | ||||
|   SECTION("undefined") { | ||||
|   SECTION("unbound") { | ||||
|     checkVariant(JsonVariant(), "\xC0");  // we represent undefined as nil | ||||
|   } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user