diff options
| author | Phil Nash | 2017-11-23 16:52:46 +0000 |
|---|---|---|
| committer | Phil Nash | 2017-11-23 16:52:46 +0000 |
| commit | 5323202652d061a0d1ae1cb631316d76b6c68de9 (patch) | |
| tree | 11ce35ed1057f4c489739594e0c8ab9bd4c4ad0b /include/internal/catch_assertionhandler.cpp | |
| parent | f052762c112d635e58625589487cdac06ba5ec12 (diff) | |
| download | catch3-5323202652d061a0d1ae1cb631316d76b6c68de9.tar.gz | |
Bake exception guard into assertion handler flow
Diffstat (limited to 'include/internal/catch_assertionhandler.cpp')
| -rw-r--r-- | include/internal/catch_assertionhandler.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/include/internal/catch_assertionhandler.cpp b/include/internal/catch_assertionhandler.cpp index 3465269f..60f97617 100644 --- a/include/internal/catch_assertionhandler.cpp +++ b/include/internal/catch_assertionhandler.cpp @@ -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 ) { |