diff options
| author | Leitwolf11 | 2026-11-01 20:05:56 +0300 |
|---|---|---|
| committer | Leitwolf11 | 2026-11-01 20:05:56 +0300 |
| commit | 8603d31fd8c1a72e30cb444f278d7a0592383ba7 (patch) | |
| tree | 496d26ff659e92cdf4e6fe27a4aa47bf52818052 /src/Progmasoft/Catch3/Internal/RunContext.cpp | |
| parent | 2aea9dafd283d69bec459ea0d495c25d1f6a0f94 (diff) | |
| download | catch3-8603d31fd8c1a72e30cb444f278d7a0592383ba7.tar.gz | |
Answer the review of the mocksfeature/mocking
A report no longer throws, so a noexcept mock survives an aborting run.
A call that has nothing to return still leaves the test case, which ends
the process in a noexcept function; the documentation says so.
RunContext clears the result capture when it goes, so a mock of static
lifetime finds none and writes to standard error.
Decision owns its source line, since Verify can free the expectation
while a call is on its way. Moving a result out takes the lock. Vector
matchers refer to their vector, so they are rejected at compile time
like composed ones. A null text expectation accepts only null, and
integers compare by value, so 256 no longer accepts an unsigned char.
Diffstat (limited to 'src/Progmasoft/Catch3/Internal/RunContext.cpp')
| -rw-r--r-- | src/Progmasoft/Catch3/Internal/RunContext.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Progmasoft/Catch3/Internal/RunContext.cpp b/src/Progmasoft/Catch3/Internal/RunContext.cpp index e86be2e4..30af4533 100644 --- a/src/Progmasoft/Catch3/Internal/RunContext.cpp +++ b/src/Progmasoft/Catch3/Internal/RunContext.cpp @@ -356,6 +356,11 @@ namespace Catch { RunContext::~RunContext() { updateTotalsFromAtomics(); m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, aborting())); + // What outlives the run, such as a mock of static lifetime, must not + // find a capture that is gone. + if ( getCurrentContext().getResultCapture() == this ) { + getCurrentMutableContext().setResultCapture( nullptr ); + } } Totals RunContext::runTest(TestCaseHandle const& testCase) { |