From de77ff3b29fe02de338ed30cc515288c312067e0 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 10 Dec 2010 20:06:54 +0000 Subject: [PATCH] Some tidy up --- catch_reporter_basic.hpp | 5 ++--- catch_reporter_junit.hpp | 8 -------- internal/catch_common.h | 2 +- internal/catch_reporter_registry.hpp | 12 +++++++++++- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/catch_reporter_basic.hpp b/catch_reporter_basic.hpp index 4a656fb0..0d209e0a 100644 --- a/catch_reporter_basic.hpp +++ b/catch_reporter_basic.hpp @@ -61,7 +61,6 @@ namespace Catch m_config.stream() << "[Testing completed. "; ReportCounts( succeeded, failed ); 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 ) { if( !stdOut.empty() ) - m_config.stream() << "[stdout: " << stdOut << "]\n"; + m_config.stream() << "[stdout: " << trim( stdOut ) << "]\n"; if( !stdErr.empty() ) - m_config.stream() << "[stderr: " << stdErr << "]\n"; + m_config.stream() << "[stderr: " << trim( stdErr ) << "]\n"; m_config.stream() << "[Finished: " << testInfo.getName() << "]" << std::endl; } diff --git a/catch_reporter_junit.hpp b/catch_reporter_junit.hpp index 93535f7f..68c08e8a 100644 --- a/catch_reporter_junit.hpp +++ b/catch_reporter_junit.hpp @@ -168,14 +168,6 @@ namespace Catch 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 */ ) { diff --git a/internal/catch_common.h b/internal/catch_common.h index 7a882e64..1491f7e5 100644 --- a/internal/catch_common.h +++ b/internal/catch_common.h @@ -32,7 +32,7 @@ namespace Catch // create a T for use in sizeof expressions template T Synth(); - + } #endif // TWOBLUECUBES_CATCH_COMMON_H_INCLUDED \ No newline at end of file diff --git a/internal/catch_reporter_registry.hpp b/internal/catch_reporter_registry.hpp index df4e3241..b9996774 100644 --- a/internal/catch_reporter_registry.hpp +++ b/internal/catch_reporter_registry.hpp @@ -22,6 +22,16 @@ 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 { private: @@ -167,7 +177,7 @@ namespace Catch { ReporterRegistry::instance().registerReporter( name ); } - }; + }; } #define CATCH_REGISTER_REPORTER( name, reporterType ) Catch::ReporterRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ReporterReg )( name );