mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-23 03:43:28 +01:00
Fixed null string reporting issue
This commit is contained in:
parent
331188f6b3
commit
8087f5738c
@ -105,3 +105,14 @@ TEST_CASE( "./succeeding/Misc/stdout,stderr", "Sends stuff to stdout and stderr"
|
||||
|
||||
std::cerr << "An error";
|
||||
}
|
||||
|
||||
const char* makeString( bool makeNull )
|
||||
{
|
||||
return makeNull ? NULL : "valid string";
|
||||
}
|
||||
|
||||
TEST_CASE( "./succeeding/Misc/null strings", "" )
|
||||
{
|
||||
REQUIRE( makeString( false ) != static_cast<char*>(NULL));
|
||||
REQUIRE( makeString( true ) == static_cast<char*>(NULL));
|
||||
}
|
||||
|
@ -105,15 +105,23 @@ inline std::string toString
|
||||
{
|
||||
return value;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
inline std::string toString
|
||||
(
|
||||
const char* const value
|
||||
)
|
||||
{
|
||||
return value ? "'" + std::string( value ) + "'" : std::string( "{null string}" );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
inline std::string toString
|
||||
(
|
||||
const char* value
|
||||
char* const value
|
||||
)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
return toString( static_cast<const char* const>( value ) );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
inline std::string toString
|
||||
|
Loading…
Reference in New Issue
Block a user