mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Put quote marks around printed characters; also nicely print some escapes
This commit is contained in:
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 ) {
|
||||
|
Loading…
Reference in New Issue
Block a user