Fixed iOS test runner after reporter changes

This commit is contained in:
Phil Nash 2012-02-27 19:03:54 +00:00
parent 20df8c5da1
commit e1f1c6ca7e
3 changed files with 23 additions and 21 deletions

View File

@ -49,7 +49,7 @@ namespace Catch
{
ConsoleColourImpl()
: hStdout( GetStdHandle(STD_OUTPUT_HANDLE) ),
wOldColorAttrs( 0 )
wOldColorAttrs( 0 )
{
GetConsoleScreenBufferInfo( hStdout, &csbiInfo );
wOldColorAttrs = csbiInfo.wAttributes;

View File

@ -80,17 +80,17 @@
config.getReporter()->StartGroup( "" );
runner.runAll( true );
config.getReporter()->EndGroup( "", runner.getSuccessCount(), runner.getFailureCount() );
config.getReporter()->EndGroup( "", runner.getTotals() );
if( runner.getFailureCount() == 0 )
if( runner.getTotals().assertions.failed == 0 )
{
NSLog( @"no failures" );
if( runner.getSuccessCount() > 0 )
if( runner.getTotals().assertions.passed > 0 )
appName.textColor = [[UIColor alloc] initWithRed:0.35 green:1 blue:0.35 alpha:1];
}
else
{
NSLog( @"%lu failures", runner.getFailureCount() );
NSLog( @"%lu failures", runner.getTotals().assertions.failed );
appName.textColor = [[UIColor alloc] initWithRed:1 green:0.35 blue:0.35 alpha:1];
}
}

View File

@ -24,11 +24,17 @@ namespace Catch
(
id<iTchRunnerDelegate> delegate
)
: m_succeeded( 0 ),
m_failed( 0 ),
m_delegate( delegate )
: m_delegate( delegate )
{
}
///////////////////////////////////////////////////////////////////////////
virtual bool shouldRedirectStdout
()
const
{
return true;
}
///////////////////////////////////////////////////////////////////////////
static std::string getDescription
@ -42,7 +48,7 @@ namespace Catch
()
const
{
return m_succeeded;
return m_totals.assertions.passed;
}
///////////////////////////////////////////////////////////////////////////
@ -50,14 +56,13 @@ namespace Catch
()
const
{
return m_failed;
return m_totals.assertions.failed;
}
///////////////////////////////////////////////////////////////////////////
void reset()
{
m_succeeded = 0;
m_failed = 0;
m_totals = Totals();
}
private: // IReporter
@ -70,12 +75,10 @@ namespace Catch
///////////////////////////////////////////////////////////////////////////
virtual void EndTesting
(
std::size_t succeeded,
std::size_t failed
const Totals& totals
)
{
m_succeeded = succeeded;
m_failed = failed;
m_totals = totals;
}
///////////////////////////////////////////////////////////////////////////
@ -90,15 +93,14 @@ namespace Catch
///////////////////////////////////////////////////////////////////////////
// Deliberately unimplemented:
virtual void StartGroup( const std::string& ){}
virtual void EndGroup( const std::string&, std::size_t, std::size_t ){}
virtual void EndGroup( const std::string&, const Totals& ){}
virtual void StartTestCase( const TestCaseInfo& ){}
virtual void StartSection( const std::string&, const std::string ){}
virtual void EndSection( const std::string&, std::size_t, std::size_t ){}
virtual void EndTestCase( const TestCaseInfo&, std::size_t, std::size_t, const std::string&, const std::string& ){}
virtual void EndSection( const std::string&, const Counts& ){}
virtual void EndTestCase( const TestCaseInfo&, const Totals&, const std::string&, const std::string& ){}
private:
size_t m_succeeded;
size_t m_failed;
Totals m_totals;
id<iTchRunnerDelegate> m_delegate;
};