mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-17 11:12:25 +01:00
Put quote marks around printed characters; also nicely print some escapes
This commit is contained in:
parent
f4ba8aaf19
commit
d81594d7b7
@ -149,9 +149,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 ) {
|
||||
|
Loading…
Reference in New Issue
Block a user