mirror of
				https://github.com/bblanchon/ArduinoJson.git
				synced 2025-11-04 08:31:36 +01:00 
			
		
		
		
	
		
			
	
	
		
			23 lines
		
	
	
		
			492 B
		
	
	
	
		
			C++
		
	
	
	
	
	
		
		
			
		
	
	
			23 lines
		
	
	
		
			492 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| 
								 | 
							
								// ArduinoJson - https://arduinojson.org
							 | 
						||
| 
								 | 
							
								// Copyright © 2014-2025, Benoit BLANCHON
							 | 
						||
| 
								 | 
							
								// MIT License
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include <ArduinoJson.h>
							 | 
						||
| 
								 | 
							
								#include <catch.hpp>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								struct CCLASS {
							 | 
						||
| 
								 | 
							
								  static const char mszKey[];
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								TEST_CASE("Issue #2166") {
							 | 
						||
| 
								 | 
							
								  JsonDocument doc;
							 | 
						||
| 
								 | 
							
								  doc[CCLASS::mszKey] = 12;
							 | 
						||
| 
								 | 
							
								  REQUIRE(doc.as<std::string>() == "{\"test3\":12}");
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  JsonObject obj = doc.to<JsonObject>();
							 | 
						||
| 
								 | 
							
								  obj[CCLASS::mszKey] = 12;
							 | 
						||
| 
								 | 
							
								  REQUIRE(doc.as<std::string>() == "{\"test3\":12}");
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const char CCLASS::mszKey[] = "test3";
							 |