diff options
| author | Phil Nash | 2017-11-23 19:14:26 +0000 |
|---|---|---|
| committer | Phil Nash | 2017-11-23 19:14:26 +0000 |
| commit | 9329d97a43b36aa2499ac1bc1e7ed78815ca2584 (patch) | |
| tree | 24bbdef4560291e92f09f56581c5b156c94ba3ad /include/internal/catch_assertionhandler.cpp | |
| parent | 8141a7836fb22d1c19f738549e404263c5639f6c (diff) | |
| download | catch3-9329d97a43b36aa2499ac1bc1e7ed78815ca2584.tar.gz | |
Always debug-break non-inline
Diffstat (limited to 'include/internal/catch_assertionhandler.cpp')
| -rw-r--r-- | include/internal/catch_assertionhandler.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/include/internal/catch_assertionhandler.cpp b/include/internal/catch_assertionhandler.cpp index 8aa7573d..0fe8e3e9 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_handled ) { + if ( !m_completed ) { handle( ResultWas::ThrewException, "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE" ); getCurrentContext().getResultCapture()->exceptionEarlyReported(); } @@ -76,7 +76,6 @@ namespace Catch { { getCurrentContext().getResultCapture()->assertionRun(); getCurrentContext().getResultCapture()->assertionPassed(); - m_handled = true; return; } @@ -96,7 +95,6 @@ namespace Catch { } void AssertionHandler::handle( AssertionResultData const& resultData, ITransientExpression const* expr ) { - m_handled = true; getResultCapture().assertionRun(); AssertionResult assertionResult{ m_assertionInfo, resultData }; @@ -116,20 +114,22 @@ namespace Catch { return getCurrentContext().getConfig()->allowThrows(); } - void AssertionHandler::reactWithDebugBreak() const { - if (m_shouldDebugBreak) { - /////////////////////////////////////////////////////////////////// - // To inspect the state during test, you need to go one level up the callstack - // To go back to the test and change execution, jump over the reactWithoutDebugBreak() call - /////////////////////////////////////////////////////////////////// + void AssertionHandler::complete() { + setCompleted(); + if( m_shouldDebugBreak ) { + + // If you find your debugger stopping you here then go one level up on the + // call-stack for the code that caused it (typically a failed assertion) + + // (To go back to the test and change execution, jump over the throw, next) CATCH_BREAK_INTO_DEBUGGER(); } - reactWithoutDebugBreak(); - } - void AssertionHandler::reactWithoutDebugBreak() const { if( m_shouldThrow ) throw Catch::TestFailureException(); } + void AssertionHandler::setCompleted() { + m_completed = true; + } void AssertionHandler::useActiveException() { handle( ResultWas::ThrewException, Catch::translateActiveException() ); |