mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Add safe bool idiom in JsonString
				
					
				
			This commit is contained in:
		| @@ -14,6 +14,23 @@ TEST_CASE("JsonString") { | ||||
|     CHECK(s.isStatic() == true); | ||||
|   } | ||||
|  | ||||
|   SECTION("Compare null with boolean") { | ||||
|     JsonString s; | ||||
|  | ||||
|     CHECK(bool(s) == false); | ||||
|     CHECK(false == bool(s)); | ||||
|     CHECK(bool(s) != true); | ||||
|     CHECK(true != bool(s)); | ||||
|   } | ||||
|  | ||||
|   SECTION("Compare non-null with boolean") { | ||||
|     JsonString s("hello"); | ||||
|     CHECK(bool(s) == true); | ||||
|     CHECK(true == bool(s)); | ||||
|     CHECK(bool(s) != false); | ||||
|     CHECK(false != bool(s)); | ||||
|   } | ||||
|  | ||||
|   SECTION("Compare null with null") { | ||||
|     JsonString a, b; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user