mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 07:16:10 +01:00
Move debug break out of tests, speeds up compilation time
This is hidden behind CATCH_CONFIG_FAST_COMPILE
This commit is contained in:
parent
6da5e0862a
commit
7b13a8f85a
@ -18,6 +18,14 @@
|
|||||||
#include "catch_compiler_capabilities.h"
|
#include "catch_compiler_capabilities.h"
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(CATCH_CONFIG_FAST_COMPILE)
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// We can speedup compilation significantly by breaking into debugger lower in
|
||||||
|
// the callstack, because then we don't have to expand CATCH_BREAK_INTO_DEBUGGER
|
||||||
|
// macro in each assertion
|
||||||
|
#define INTERNAL_CATCH_REACT( resultBuilder ) \
|
||||||
|
resultBuilder.react();
|
||||||
|
#else
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// In the event of a failure works out if the debugger needs to be invoked
|
// In the event of a failure works out if the debugger needs to be invoked
|
||||||
// and/or an exception thrown and takes appropriate action.
|
// and/or an exception thrown and takes appropriate action.
|
||||||
@ -26,6 +34,7 @@
|
|||||||
#define INTERNAL_CATCH_REACT( resultBuilder ) \
|
#define INTERNAL_CATCH_REACT( resultBuilder ) \
|
||||||
if( resultBuilder.shouldDebugBreak() ) CATCH_BREAK_INTO_DEBUGGER(); \
|
if( resultBuilder.shouldDebugBreak() ) CATCH_BREAK_INTO_DEBUGGER(); \
|
||||||
resultBuilder.react();
|
resultBuilder.react();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -99,6 +99,15 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ResultBuilder::react() {
|
void ResultBuilder::react() {
|
||||||
|
#if defined(CATCH_CONFIG_FAST_COMPILE)
|
||||||
|
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 throw statement
|
||||||
|
///////////////////////////////////////////////////////////////////
|
||||||
|
CATCH_BREAK_INTO_DEBUGGER();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if( m_shouldThrow )
|
if( m_shouldThrow )
|
||||||
throw Catch::TestFailureException();
|
throw Catch::TestFailureException();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user