mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-03 21:49:32 +01:00 
			
		
		
		
	Put quote marks around printed characters; also nicely print some escapes
This commit is contained in:
		
				
					committed by
					
						
						Martin Hořeňovský
					
				
			
			
				
	
			
			
			
						parent
						
							1e5176bd69
						
					
				
				
					commit
					5121b5b058
				
			@@ -146,9 +146,19 @@ std::string toString( bool value ) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::string toString( char value ) {
 | 
			
		||||
    return value < ' '
 | 
			
		||||
        ? toString( static_cast<unsigned int>( value ) )
 | 
			
		||||
        : Detail::makeString( value );
 | 
			
		||||
    if ( value == '\r' )
 | 
			
		||||
        return "'\\r'";
 | 
			
		||||
    if ( value == '\l' )
 | 
			
		||||
        return "'\\l'";
 | 
			
		||||
    if ( value == '\n' )
 | 
			
		||||
        return "'\\n'";
 | 
			
		||||
    if ( value == '\t' )
 | 
			
		||||
        return "'\\t'";
 | 
			
		||||
    if ( '\0' <= value && value < ' ' )
 | 
			
		||||
        return toString( static_cast<unsigned int>( value ) );
 | 
			
		||||
    char chstr[] = "' '";
 | 
			
		||||
    chstr[1] = value;
 | 
			
		||||
    return chstr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::string toString( signed char value ) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user