mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 07:16: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"
|
#include "../catch_runner.hpp"
|
||||||
|
|
||||||
// This code runs the meta tests and verifies that the failing ones failed and the successful ones succeeded
|
// 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[])
|
int main (int argc, char * const argv[])
|
||||||
{
|
{
|
||||||
using namespace Catch;
|
using namespace Catch;
|
||||||
@ -26,17 +25,16 @@ int main (int argc, char * const argv[])
|
|||||||
std::ostringstream ossSucceeding;
|
std::ostringstream ossSucceeding;
|
||||||
std::ostringstream ossFailing;
|
std::ostringstream ossFailing;
|
||||||
|
|
||||||
RunnerConfig config;
|
Config config;
|
||||||
ReporterConfig& reporterConfig = config.getReporterConfig();
|
config.setReporter( "Basic" );
|
||||||
config.setReporter( new BasicReporter(reporterConfig ) );
|
config.setIncludeWhat( Config::Include::SuccessfulResults );
|
||||||
reporterConfig.setIncludeWhat( ReporterConfig::Include::SuccessfulResults );
|
|
||||||
Runner runner( config );
|
Runner runner( config );
|
||||||
|
|
||||||
reporterConfig.setStreamBuf( ossSucceeding.rdbuf() );
|
config.setStreamBuf( ossSucceeding.rdbuf() );
|
||||||
runner.runMatching( "succeeding/*" );
|
runner.runMatching( "succeeding/*" );
|
||||||
std::string succeedingResults = ossSucceeding.str();
|
std::string succeedingResults = ossSucceeding.str();
|
||||||
|
|
||||||
reporterConfig.setStreamBuf( ossFailing.rdbuf() );
|
config.setStreamBuf( ossFailing.rdbuf() );
|
||||||
runner.runMatching( "failing/*" );
|
runner.runMatching( "failing/*" );
|
||||||
std::string failingResults = ossFailing.str();
|
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
|
const size_t expectedTestCaseCount = 106; // !TBD factor this out
|
||||||
size_t testCaseCount = runner.getSuccessCount() + runner.getFailureCount();
|
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 )
|
if( testCaseCount != expectedTestCaseCount )
|
||||||
{
|
{
|
||||||
std::cerr << "- but we were expecting " << expectedTestCaseCount
|
std::cerr << "- but we were expecting " << expectedTestCaseCount
|
||||||
@ -76,5 +74,3 @@ int main (int argc, char * const argv[])
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
//*/
|
|
||||||
//#include "catch_default_main.hpp"
|
|
@ -147,7 +147,7 @@ namespace Catch
|
|||||||
case modeReport:
|
case modeReport:
|
||||||
if( m_args.size() != 1 )
|
if( m_args.size() != 1 )
|
||||||
return setErrorMode( m_command + " expected one argument, recieved: " + argsAsString() );
|
return setErrorMode( m_command + " expected one argument, recieved: " + argsAsString() );
|
||||||
m_config.setReporterInfo( m_args[0] );
|
m_config.setReporter( m_args[0] );
|
||||||
break;
|
break;
|
||||||
case modeOutput:
|
case modeOutput:
|
||||||
if( m_args.size() == 0 )
|
if( m_args.size() == 0 )
|
||||||
|
@ -62,7 +62,7 @@ namespace Catch
|
|||||||
m_includeWhat( Include::FailedOnly )
|
m_includeWhat( Include::FailedOnly )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void setReporterInfo( const std::string& reporterName )
|
void setReporter( const std::string& reporterName )
|
||||||
{
|
{
|
||||||
if( m_reporter.get() )
|
if( m_reporter.get() )
|
||||||
return setError( "Only one reporter may be specified" );
|
return setError( "Only one reporter may be specified" );
|
||||||
|
Loading…
Reference in New Issue
Block a user