🔨 fixed some warnings
This commit is contained in:
		
							parent
							
								
									c7a69ae03e
								
							
						
					
					
						commit
						d53ef95067
					
				
					 2 changed files with 11 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -32,6 +32,15 @@ SOFTWARE.
 | 
			
		|||
#include "json.hpp"
 | 
			
		||||
using nlohmann::json;
 | 
			
		||||
 | 
			
		||||
void check_escaped(const char* original, const char* escaped, const bool ensure_ascii = false);
 | 
			
		||||
void check_escaped(const char* original, const char* escaped, const bool ensure_ascii)
 | 
			
		||||
{
 | 
			
		||||
    std::stringstream ss;
 | 
			
		||||
    json::serializer s(nlohmann::detail::output_adapter_factory<char>::create(ss), ' ');
 | 
			
		||||
    s.dump_escaped(original, ensure_ascii);
 | 
			
		||||
    CHECK(ss.str() == escaped);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST_CASE("convenience functions")
 | 
			
		||||
{
 | 
			
		||||
    SECTION("type name as string")
 | 
			
		||||
| 
						 | 
				
			
			@ -49,16 +58,6 @@ TEST_CASE("convenience functions")
 | 
			
		|||
 | 
			
		||||
    SECTION("string escape")
 | 
			
		||||
    {
 | 
			
		||||
        const auto check_escaped = [](const char* original,
 | 
			
		||||
                                      const char* escaped,
 | 
			
		||||
                                      const bool ensure_ascii = false)
 | 
			
		||||
        {
 | 
			
		||||
            std::stringstream ss;
 | 
			
		||||
            json::serializer s(nlohmann::detail::output_adapter_factory<char>::create(ss), ' ');
 | 
			
		||||
            s.dump_escaped(original, ensure_ascii);
 | 
			
		||||
            CHECK(ss.str() == escaped);
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        check_escaped("\"", "\\\"");
 | 
			
		||||
        check_escaped("\\", "\\\\");
 | 
			
		||||
        check_escaped("\b", "\\b");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue