From b87a16d11a5910fcdb49e2f849fcd3af5cf029d6 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 5 Jan 2011 21:07:20 +0000 Subject: [PATCH] Fixed TestMain after recent refactorings --- Test/TestMain.cpp | 16 ++++++---------- internal/catch_commandline.hpp | 2 +- internal/catch_config.hpp | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/Test/TestMain.cpp b/Test/TestMain.cpp index 7d8c1d5c..53782bca 100644 --- a/Test/TestMain.cpp +++ b/Test/TestMain.cpp @@ -14,7 +14,6 @@ #include "../catch_runner.hpp" // This code runs the meta tests and verifies that the failing ones failed and the successful ones succeeded -///* int main (int argc, char * const argv[]) { using namespace Catch; @@ -26,17 +25,16 @@ int main (int argc, char * const argv[]) std::ostringstream ossSucceeding; std::ostringstream ossFailing; - RunnerConfig config; - ReporterConfig& reporterConfig = config.getReporterConfig(); - config.setReporter( new BasicReporter(reporterConfig ) ); - reporterConfig.setIncludeWhat( ReporterConfig::Include::SuccessfulResults ); + Config config; + config.setReporter( "Basic" ); + config.setIncludeWhat( Config::Include::SuccessfulResults ); Runner runner( config ); - reporterConfig.setStreamBuf( ossSucceeding.rdbuf() ); + config.setStreamBuf( ossSucceeding.rdbuf() ); runner.runMatching( "succeeding/*" ); std::string succeedingResults = ossSucceeding.str(); - reporterConfig.setStreamBuf( ossFailing.rdbuf() ); + config.setStreamBuf( ossFailing.rdbuf() ); runner.runMatching( "failing/*" ); std::string failingResults = ossFailing.str(); @@ -64,7 +62,7 @@ int main (int argc, char * const argv[]) { const size_t expectedTestCaseCount = 106; // !TBD factor this out size_t testCaseCount = runner.getSuccessCount() + runner.getFailureCount(); - std::cout << "All " << testCaseCount << " tests completed successfully" << std::endl; + std::cout << "All " << testCaseCount << " test(s) completed successfully" << std::endl; if( testCaseCount != expectedTestCaseCount ) { std::cerr << "- but we were expecting " << expectedTestCaseCount @@ -76,5 +74,3 @@ int main (int argc, char * const argv[]) } return result; } -//*/ -//#include "catch_default_main.hpp" \ No newline at end of file diff --git a/internal/catch_commandline.hpp b/internal/catch_commandline.hpp index 0155fa00..3f83813b 100644 --- a/internal/catch_commandline.hpp +++ b/internal/catch_commandline.hpp @@ -147,7 +147,7 @@ namespace Catch case modeReport: if( m_args.size() != 1 ) return setErrorMode( m_command + " expected one argument, recieved: " + argsAsString() ); - m_config.setReporterInfo( m_args[0] ); + m_config.setReporter( m_args[0] ); break; case modeOutput: if( m_args.size() == 0 ) diff --git a/internal/catch_config.hpp b/internal/catch_config.hpp index 009497c2..672fe6d9 100644 --- a/internal/catch_config.hpp +++ b/internal/catch_config.hpp @@ -62,7 +62,7 @@ namespace Catch m_includeWhat( Include::FailedOnly ) {} - void setReporterInfo( const std::string& reporterName ) + void setReporter( const std::string& reporterName ) { if( m_reporter.get() ) return setError( "Only one reporter may be specified" );