Bake exception guard into assertion handler flow

This commit is contained in:
Phil Nash 2017-11-23 16:52:46 +00:00
parent f052762c11
commit 5323202652
4 changed files with 9 additions and 18 deletions

View file

@ -61,7 +61,7 @@ namespace Catch {
getCurrentContext().getResultCapture()->assertionStarting( m_assertionInfo );
}
AssertionHandler::~AssertionHandler() {
if ( m_inExceptionGuard ) {
if ( !m_handled ) {
handle( ResultWas::ThrewException, "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE" );
getCurrentContext().getResultCapture()->exceptionEarlyReported();
}
@ -76,6 +76,7 @@ namespace Catch {
{
getCurrentContext().getResultCapture()->assertionRun();
getCurrentContext().getResultCapture()->assertionPassed();
m_handled = true;
return;
}
@ -95,6 +96,7 @@ namespace Catch {
}
void AssertionHandler::handle( AssertionResultData const& resultData, ITransientExpression const* expr ) {
m_handled = true;
getResultCapture().assertionRun();
AssertionResult assertionResult{ m_assertionInfo, resultData };
@ -136,15 +138,6 @@ namespace Catch {
handle( ResultWas::ThrewException, Catch::translateActiveException() );
}
void AssertionHandler::setExceptionGuard() {
assert( m_inExceptionGuard == false );
m_inExceptionGuard = true;
}
void AssertionHandler::unsetExceptionGuard() {
assert( m_inExceptionGuard == true );
m_inExceptionGuard = false;
}
// This is the overload that takes a string and infers the Equals matcher from it
// The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp
void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString ) {