Separated getting test cases to run from running them

This commit is contained in:
Phil Nash 2012-08-15 19:12:51 +01:00
parent d0a5461add
commit c1dbc9c22b
9 changed files with 92 additions and 80 deletions

View file

@ -114,17 +114,13 @@ namespace Catch {
public:
EmbeddedRunner() : m_reporter( new MockReporter() ) {}
std::size_t runMatching( const std::string& rawTestSpec,
const std::string& reporter = "basic" );
Totals runMatching( const std::string& rawTestSpec,
const std::string& reporter = "basic" );
std::string getOutput() {
return m_output;
}
const Totals& getTotals() const {
return m_totals;
}
void addRecorder( const std::string& recorder ) {
m_reporter->addRecorder( recorder );
}
@ -134,7 +130,6 @@ namespace Catch {
}
private:
Totals m_totals;
std::string m_output;
Ptr<MockReporter> m_reporter;
};
@ -157,8 +152,7 @@ namespace Catch {
void operator()( const TestCaseInfo& testCase ) {
EmbeddedRunner runner;
runner.runMatching( testCase.getName() );
Totals totals = runner.getTotals();
Totals totals = runner.runMatching( testCase.getName() );
switch( m_expectedResult ) {
case Expected::ToSucceed:
if( totals.assertions.failed > 0 ) {