Only report test case once for all sections within it

This commit is contained in:
Phil Nash 2011-01-19 19:30:01 +00:00
parent 6a6b346731
commit 455c2998a0

View File

@ -187,16 +187,26 @@ namespace Catch
const TestCaseInfo& testInfo const TestCaseInfo& testInfo
) )
{ {
std::size_t prevSuccessCount = m_successes;
std::size_t prevFailureCount = m_failures;
std::string redirectedCout;
std::string redirectedCerr;
m_reporter->StartTestCase( testInfo );
m_runningTest = RunningTest( &testInfo ); m_runningTest = RunningTest( &testInfo );
do do
{ {
m_runningTest.resetSectionSeen(); m_runningTest.resetSectionSeen();
runCurrentTest(); runCurrentTest( redirectedCout, redirectedCerr );
} }
while( m_runningTest.wasSectionSeen() ); while( m_runningTest.wasSectionSeen() );
m_runningTest = RunningTest(); m_runningTest = RunningTest();
m_reporter->EndTestCase( testInfo, m_successes - prevSuccessCount, m_failures - prevFailureCount, redirectedCout, redirectedCerr );
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -352,16 +362,11 @@ namespace Catch
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void runCurrentTest void runCurrentTest
() (
std::string& redirectedCout,
std::string& redirectedCerr
)
{ {
std::size_t prevSuccessCount = m_successes;
std::size_t prevFailureCount = m_failures;
m_reporter->StartTestCase( m_runningTest.getTestCaseInfo() );
std::string redirectedCout;
std::string redirectedCerr;
try try
{ {
StreamRedirect coutRedir( std::cout, redirectedCout ); StreamRedirect coutRedir( std::cout, redirectedCout );
@ -383,7 +388,6 @@ namespace Catch
acceptResult( ResultWas::ThrewException ); acceptResult( ResultWas::ThrewException );
} }
m_info.clear(); m_info.clear();
m_reporter->EndTestCase( m_runningTest.getTestCaseInfo(), m_successes - prevSuccessCount, m_failures - prevFailureCount, redirectedCout, redirectedCerr );
} }
private: private: