mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Added a test that removes an element during iteration (#1332)
This commit is contained in:
		| @@ -65,4 +65,15 @@ TEST_CASE("JsonArray::remove()") { | ||||
|     REQUIRE(_array[0] == 1); | ||||
|     REQUIRE(_array[1] == 2); | ||||
|   } | ||||
|  | ||||
|   SECTION("In a loop") { | ||||
|     for (JsonArray::iterator it = _array.begin(); it != _array.end(); ++it) { | ||||
|       if (*it == 2) | ||||
|         _array.remove(it); | ||||
|     } | ||||
|  | ||||
|     REQUIRE(2 == _array.size()); | ||||
|     REQUIRE(_array[0] == 1); | ||||
|     REQUIRE(_array[1] == 3); | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user