Some toString cleanups

This commit is contained in:
Phil Nash 2014-12-09 18:49:58 +00:00
parent 32186db1b0
commit b0545d1f12
5 changed files with 8 additions and 10 deletions

View File

@ -81,8 +81,7 @@ namespace Detail {
}; };
} }
template<> inline std::string toString( Detail::Approx const& value ) {
inline std::string toString<Detail::Approx>( Detail::Approx const& value ) {
return value.toString(); return value.toString();
} }

View File

@ -35,7 +35,7 @@ namespace Catch {
throw; throw;
} }
@catch (NSException *exception) { @catch (NSException *exception) {
return toString( [exception description] ); return Catch::toString( [exception description] );
} }
#else #else
throw; throw;

View File

@ -219,10 +219,9 @@ std::string toString( std::nullptr_t );
std::ostringstream oss; std::ostringstream oss;
oss << "{ "; oss << "{ ";
if( first != last ) { if( first != last ) {
oss << toString( *first ); oss << Catch::toString( *first );
for( ++first ; first != last ; ++first ) { for( ++first ; first != last ; ++first )
oss << ", " << toString( *first ); oss << ", " << Catch::toString( *first );
}
} }
oss << " }"; oss << " }";
return oss.str(); return oss.str();

View File

@ -75,7 +75,7 @@ std::string toString( std::wstring const& value ) {
s.reserve( value.size() ); s.reserve( value.size() );
for(size_t i = 0; i < value.size(); ++i ) for(size_t i = 0; i < value.size(); ++i )
s += value[i] <= 0xff ? static_cast<char>( value[i] ) : '?'; s += value[i] <= 0xff ? static_cast<char>( value[i] ) : '?';
return toString( s ); return Catch::toString( s );
} }
std::string toString( const char* const value ) { std::string toString( const char* const value ) {
@ -112,7 +112,7 @@ std::string toString( unsigned long value ) {
} }
std::string toString( unsigned int value ) { std::string toString( unsigned int value ) {
return toString( static_cast<unsigned long>( value ) ); return Catch::toString( static_cast<unsigned long>( value ) );
} }
template<typename T> template<typename T>

View File

@ -135,7 +135,7 @@ namespace Catch {
xml.writeAttribute( "classname", className ); xml.writeAttribute( "classname", className );
xml.writeAttribute( "name", name ); xml.writeAttribute( "name", name );
} }
xml.writeAttribute( "time", toString( sectionNode.stats.durationInSeconds ) ); xml.writeAttribute( "time", Catch::toString( sectionNode.stats.durationInSeconds ) );
writeAssertions( sectionNode ); writeAssertions( sectionNode );