Some tidy up

This commit is contained in:
Phil Nash 2010-12-10 20:06:54 +00:00
parent 68eec929e4
commit de77ff3b29
4 changed files with 14 additions and 13 deletions

View File

@ -61,7 +61,6 @@ namespace Catch
m_config.stream() << "[Testing completed. "; m_config.stream() << "[Testing completed. ";
ReportCounts( succeeded, failed ); ReportCounts( succeeded, failed );
m_config.stream() << "]" << std::endl; m_config.stream() << "]" << std::endl;
(succeeded, failed);
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -156,10 +155,10 @@ namespace Catch
virtual void EndTestCase( const TestCaseInfo& testInfo, const std::string& stdOut, const std::string& stdErr ) virtual void EndTestCase( const TestCaseInfo& testInfo, const std::string& stdOut, const std::string& stdErr )
{ {
if( !stdOut.empty() ) if( !stdOut.empty() )
m_config.stream() << "[stdout: " << stdOut << "]\n"; m_config.stream() << "[stdout: " << trim( stdOut ) << "]\n";
if( !stdErr.empty() ) if( !stdErr.empty() )
m_config.stream() << "[stderr: " << stdErr << "]\n"; m_config.stream() << "[stderr: " << trim( stdErr ) << "]\n";
m_config.stream() << "[Finished: " << testInfo.getName() << "]" << std::endl; m_config.stream() << "[Finished: " << testInfo.getName() << "]" << std::endl;
} }

View File

@ -168,14 +168,6 @@ namespace Catch
m_stdErr << stdErr << "\n"; m_stdErr << stdErr << "\n";
} }
static std::string trim( const std::string& str )
{
std::string::size_type start = str.find_first_not_of( "\n\r\t " );
std::string::size_type end = str.find_last_not_of( "\n\r\t " );
return start < end ? str.substr( start, 1+end-start ) : "";
}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
virtual void EndTesting( std::size_t /* succeeded */, std::size_t /* failed */ ) virtual void EndTesting( std::size_t /* succeeded */, std::size_t /* failed */ )
{ {

View File

@ -32,7 +32,7 @@ namespace Catch
// create a T for use in sizeof expressions // create a T for use in sizeof expressions
template<typename T> T Synth(); template<typename T> T Synth();
} }
#endif // TWOBLUECUBES_CATCH_COMMON_H_INCLUDED #endif // TWOBLUECUBES_CATCH_COMMON_H_INCLUDED

View File

@ -22,6 +22,16 @@
namespace Catch namespace Catch
{ {
///////////////////////////////////////////////////////////////////////////
static std::string trim( const std::string& str )
{
std::string::size_type start = str.find_first_not_of( "\n\r\t " );
std::string::size_type end = str.find_last_not_of( "\n\r\t " );
return start < end ? str.substr( start, 1+end-start ) : "";
}
class ReporterConfig class ReporterConfig
{ {
private: private:
@ -167,7 +177,7 @@ namespace Catch
{ {
ReporterRegistry::instance().registerReporter<T>( name ); ReporterRegistry::instance().registerReporter<T>( name );
} }
}; };
} }
#define CATCH_REGISTER_REPORTER( name, reporterType ) Catch::ReporterRegistrar<reporterType> INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ReporterReg )( name ); #define CATCH_REGISTER_REPORTER( name, reporterType ) Catch::ReporterRegistrar<reporterType> INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ReporterReg )( name );