mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Moved ancillary files to extras/ (fixes #1011)
				
					
				
			This commit is contained in:
		
							
								
								
									
										35
									
								
								extras/tests/JsonObject/invalid.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								extras/tests/JsonObject/invalid.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | ||||
| // ArduinoJson - arduinojson.org | ||||
| // Copyright Benoit Blanchon 2014-2019 | ||||
| // MIT License | ||||
|  | ||||
| #include <ArduinoJson.h> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| using namespace Catch::Matchers; | ||||
|  | ||||
| TEST_CASE("JsonObject::invalid()") { | ||||
|   JsonObject obj; | ||||
|  | ||||
|   SECTION("SubscriptFails") { | ||||
|     REQUIRE(obj["key"].isNull()); | ||||
|   } | ||||
|  | ||||
|   SECTION("AddFails") { | ||||
|     obj["hello"] = "world"; | ||||
|     REQUIRE(0 == obj.size()); | ||||
|   } | ||||
|  | ||||
|   SECTION("CreateNestedArrayFails") { | ||||
|     REQUIRE(obj.createNestedArray("hello").isNull()); | ||||
|   } | ||||
|  | ||||
|   SECTION("CreateNestedObjectFails") { | ||||
|     REQUIRE(obj.createNestedObject("world").isNull()); | ||||
|   } | ||||
|  | ||||
|   SECTION("serialize to 'null'") { | ||||
|     char buffer[32]; | ||||
|     serializeJson(obj, buffer, sizeof(buffer)); | ||||
|     REQUIRE_THAT(buffer, Equals("null")); | ||||
|   } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user