Rework of REQUIRE* changes in CATCH_CONFIG_FAST_COMPILE

`ResultBuilder`s destructor now checks for exceptions, preventing false
negatives. The speedup should remain the same give or take a tiny bit.
This commit is contained in:
Martin Hořeňovský 2017-03-29 21:12:06 +02:00
parent c3a41e26a7
commit 4fe2432e05
3 changed files with 27 additions and 3 deletions

View file

@ -30,9 +30,18 @@ namespace Catch {
char const* secondArg )
: m_assertionInfo( macroName, lineInfo, capturedExpressionWithSecondArgument( capturedExpression, secondArg ), resultDisposition ),
m_shouldDebugBreak( false ),
m_shouldThrow( false )
m_shouldThrow( false ),
m_guardException( false )
{}
ResultBuilder::~ResultBuilder() {
#if defined(CATCH_CONFIG_FAST_COMPILE)
if ( m_guardException ) {
useActiveException( m_assertionInfo.resultDisposition );
}
#endif
}
ResultBuilder& ResultBuilder::setResultType( ResultWas::OfType result ) {
m_data.resultType = result;
return *this;
@ -146,6 +155,13 @@ namespace Catch {
dest = m_assertionInfo.capturedExpression;
}
void ResultBuilder::setExceptionGuard() {
m_guardException = true;
}
void ResultBuilder::unsetExceptionGuard() {
m_guardException = false;
}
} // end namespace Catch
#endif // TWOBLUECUBES_CATCH_RESULT_BUILDER_HPP_INCLUDED