mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-25 23:06:10 +01:00
Fixed TestMain after recent refactorings
This commit is contained in:
parent
4220fb6267
commit
b87a16d11a
@ -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"
|
@ -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 )
|
||||
|
@ -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" );
|
||||
|
Loading…
Reference in New Issue
Block a user