diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp index a0866fd2..b23c2146 100644 --- a/src/catch2/internal/catch_run_context.cpp +++ b/src/catch2/internal/catch_run_context.cpp @@ -169,7 +169,7 @@ namespace Catch { : m_runInfo(_config->name()), m_config(_config), m_reporter(CATCH_MOVE(reporter)), - m_lastAssertionInfo{ StringRef(), SourceLineInfo("",0), StringRef(), ResultDisposition::Normal }, + m_lastKnownLineInfo("DummyLocation", static_cast(-1)), m_outputRedirect( makeOutputRedirect( m_reporter->getPreferences().shouldRedirectStdOut ) ), m_abortAfterXFailedAssertions( m_config->abortAfter() ), m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions ), @@ -307,11 +307,6 @@ namespace Catch { // populateReaction is run if it is needed m_lastResult = CATCH_MOVE( result ); } - void RunContext::resetAssertionInfo() { - m_lastAssertionInfo.macroName = StringRef(); - m_lastAssertionInfo.capturedExpression = "{Unknown expression after the reported line}"_sr; - m_lastAssertionInfo.resultDisposition = ResultDisposition::Normal; - } void RunContext::notifyAssertionStarted( AssertionInfo const& info ) { auto _ = scopedDeactivate( *m_outputRedirect ); @@ -331,7 +326,7 @@ namespace Catch { m_activeSections.push_back(§ionTracker); SectionInfo sectionInfo( sectionLineInfo, static_cast(sectionName) ); - m_lastAssertionInfo.lineInfo = sectionLineInfo; + m_lastKnownLineInfo = sectionLineInfo; { auto _ = scopedDeactivate( *m_outputRedirect ); @@ -350,7 +345,7 @@ namespace Catch { m_trackerContext, TestCaseTracking::NameAndLocationRef( generatorName, lineInfo ) ); - m_lastAssertionInfo.lineInfo = lineInfo; + m_lastKnownLineInfo = lineInfo; return tracker; } @@ -476,10 +471,10 @@ namespace Catch { // Instead, fake a result data. AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } ); tempResult.message = static_cast(message); - AssertionResult result(m_lastAssertionInfo, CATCH_MOVE(tempResult)); + AssertionResult result( makeDummyAssertionInfo(), + CATCH_MOVE( tempResult ) ); assertionEnded(CATCH_MOVE(result) ); - resetAssertionInfo(); // Best effort cleanup for sections that have not been destructed yet // Since this is a fatal error, we have not had and won't have the opportunity to destruct them properly @@ -520,7 +515,6 @@ namespace Catch { void RunContext::assertionPassed() { m_lastAssertionPassed = true; ++m_totals.assertions.passed; - resetAssertionInfo(); m_messageScopes.clear(); } @@ -535,7 +529,7 @@ namespace Catch { Counts prevAssertions = m_totals.assertions; double duration = 0; m_shouldReportUnexpected = true; - m_lastAssertionInfo = { "TEST_CASE"_sr, testCaseInfo.lineInfo, StringRef(), ResultDisposition::Normal }; + m_lastKnownLineInfo = testCaseInfo.lineInfo; Timer timer; CATCH_TRY { @@ -552,9 +546,11 @@ namespace Catch { } CATCH_CATCH_ALL { // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions // are reported without translation at the point of origin. - if( m_shouldReportUnexpected ) { + if ( m_shouldReportUnexpected ) { AssertionReaction dummyReaction; - handleUnexpectedInflightException( m_lastAssertionInfo, translateActiveException(), dummyReaction ); + handleUnexpectedInflightException( makeDummyAssertionInfo(), + translateActiveException(), + dummyReaction ); } } Counts assertions = m_totals.assertions - prevAssertions; @@ -622,14 +618,13 @@ namespace Catch { ITransientExpression const *expr, bool negated ) { - m_lastAssertionInfo.lineInfo = info.lineInfo; + m_lastKnownLineInfo = info.lineInfo; AssertionResultData data( resultType, LazyExpression( negated ) ); AssertionResult assertionResult{ info, CATCH_MOVE( data ) }; assertionResult.m_resultData.lazyExpression.m_transientExpression = expr; assertionEnded( CATCH_MOVE(assertionResult) ); - resetAssertionInfo(); } void RunContext::handleMessage( @@ -638,7 +633,7 @@ namespace Catch { std::string&& message, AssertionReaction& reaction ) { - m_lastAssertionInfo.lineInfo = info.lineInfo; + m_lastKnownLineInfo = info.lineInfo; AssertionResultData data( resultType, LazyExpression( false ) ); data.message = CATCH_MOVE( message ); @@ -655,8 +650,8 @@ namespace Catch { // considered "OK" reaction.shouldSkip = true; } - resetAssertionInfo(); } + void RunContext::handleUnexpectedExceptionNotThrown( AssertionInfo const& info, AssertionReaction& reaction @@ -669,7 +664,7 @@ namespace Catch { std::string&& message, AssertionReaction& reaction ) { - m_lastAssertionInfo.lineInfo = info.lineInfo; + m_lastKnownLineInfo = info.lineInfo; AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); data.message = CATCH_MOVE(message); @@ -677,7 +672,6 @@ namespace Catch { assertionEnded( CATCH_MOVE(assertionResult) ); populateReaction( reaction, info.resultDisposition & ResultDisposition::Normal ); - resetAssertionInfo(); } void RunContext::populateReaction( AssertionReaction& reaction, @@ -686,24 +680,36 @@ namespace Catch { reaction.shouldThrow = aborting() || has_normal_disposition; } + AssertionInfo RunContext::makeDummyAssertionInfo() { + const bool testCaseJustStarted = + m_lastKnownLineInfo == m_activeTestCase->getTestCaseInfo().lineInfo; + + return AssertionInfo{ + testCaseJustStarted ? "TEST_CASE"_sr : StringRef(), + m_lastKnownLineInfo, + testCaseJustStarted ? StringRef() : "{Unknown expression after the reported line}"_sr, + ResultDisposition::Normal + }; + } + void RunContext::handleIncomplete( AssertionInfo const& info ) { using namespace std::string_literals; - m_lastAssertionInfo.lineInfo = info.lineInfo; + m_lastKnownLineInfo = info.lineInfo; AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE"s; AssertionResult assertionResult{ info, CATCH_MOVE( data ) }; assertionEnded( CATCH_MOVE(assertionResult) ); - resetAssertionInfo(); } + void RunContext::handleNonExpr( AssertionInfo const &info, ResultWas::OfType resultType, AssertionReaction &reaction ) { - m_lastAssertionInfo.lineInfo = info.lineInfo; + m_lastKnownLineInfo = info.lineInfo; AssertionResultData data( resultType, LazyExpression( false ) ); AssertionResult assertionResult{ info, CATCH_MOVE( data ) }; @@ -714,10 +720,8 @@ namespace Catch { populateReaction( reaction, info.resultDisposition & ResultDisposition::Normal ); } - resetAssertionInfo(); } - IResultCapture& getResultCapture() { if (auto* capture = getCurrentContext().getResultCapture()) return *capture; diff --git a/src/catch2/internal/catch_run_context.hpp b/src/catch2/internal/catch_run_context.hpp index 4aecd662..ed3fda93 100644 --- a/src/catch2/internal/catch_run_context.hpp +++ b/src/catch2/internal/catch_run_context.hpp @@ -119,7 +119,6 @@ namespace Catch { void runCurrentTest(); void invokeActiveTestCase(); - void resetAssertionInfo(); bool testForMissingAssertions( Counts& assertions ); void assertionEnded( AssertionResult&& result ); @@ -131,6 +130,11 @@ namespace Catch { void populateReaction( AssertionReaction& reaction, bool has_normal_disposition ); + // Creates dummy info for unexpected exceptions/fatal errors, + // where we do not have the access to one, but we still need + // to send one to the reporters. + AssertionInfo makeDummyAssertionInfo(); + private: void handleUnfinishedSections(); @@ -145,16 +149,18 @@ namespace Catch { IEventListenerPtr m_reporter; std::vector m_messages; std::vector m_messageScopes; /* Keeps owners of so-called unscoped messages. */ - AssertionInfo m_lastAssertionInfo; + SourceLineInfo m_lastKnownLineInfo; std::vector m_unfinishedSections; std::vector m_activeSections; TrackerContext m_trackerContext; Detail::unique_ptr m_outputRedirect; FatalConditionHandler m_fatalConditionhandler; + // Caches m_config->abortAfter() to avoid vptr calls/allow inlining size_t m_abortAfterXFailedAssertions; bool m_lastAssertionPassed = false; bool m_shouldReportUnexpected = true; bool m_includeSuccessfulResults; + // Caches m_config->shouldDebugBreak() to avoid vptr calls/allow inlining bool m_shouldDebugBreak; }; diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index 840d3dcb..5e2fef69 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -84,8 +84,8 @@ Matchers.tests.cpp:: passed: smallest_non_zero, WithinULP( -smalles Matchers.tests.cpp:: passed: smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0 not is within 1 ULPs of -4.9406564584124654e-324 ([-9.8813129168249309e-324, -0.0000000000000000e+00]) Matchers.tests.cpp:: passed: smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) for: 0.0f is within 2 ULPs of -1.40129846e-45f ([-4.20389539e-45, 1.40129846e-45]) Matchers.tests.cpp:: passed: smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0.00000000e+00]) -Generators.tests.cpp:: failed: unexpected exception with message: 'failure to init' -Exception.tests.cpp:: failed: unexpected exception with message: 'answer := 42' with 1 message: 'expected exception' +Generators.tests.cpp:: failed: unexpected exception with message: 'failure to init'; expression was: {Unknown expression after the reported line} +Exception.tests.cpp:: failed: unexpected exception with message: 'answer := 42'; expression was: {Unknown expression after the reported line} with 1 message: 'expected exception' Exception.tests.cpp:: failed: unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception' Exception.tests.cpp:: passed: thisThrows() with 1 message: 'answer := 42' Compilation.tests.cpp:: passed: 42 == f for: 42 == {?} @@ -2392,7 +2392,7 @@ Exception.tests.cpp:: failed: unexpected exception with message: 'u Exception.tests.cpp:: failed: unexpected exception with message: 'expected exception'; expression was: thisThrows() == 0 Exception.tests.cpp:: failed: unexpected exception with message: 'expected exception'; expression was: thisThrows() == 0 Exception.tests.cpp:: failed: unexpected exception with message: 'expected exception'; expression was: thisThrows() == 0 -Exception.tests.cpp:: failed: unexpected exception with message: 'unexpected exception' +Exception.tests.cpp:: failed: unexpected exception with message: 'unexpected exception'; expression was: {Unknown expression after the reported line} Tricky.tests.cpp:: passed: Tricky.tests.cpp:: passed: Tricky.tests.cpp:: passed: diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt index 933a887a..e96370e0 100644 --- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt @@ -82,8 +82,8 @@ Matchers.tests.cpp:: passed: smallest_non_zero, WithinULP( -smalles Matchers.tests.cpp:: passed: smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0 not is within 1 ULPs of -4.9406564584124654e-324 ([-9.8813129168249309e-324, -0.0000000000000000e+00]) Matchers.tests.cpp:: passed: smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) for: 0.0f is within 2 ULPs of -1.40129846e-45f ([-4.20389539e-45, 1.40129846e-45]) Matchers.tests.cpp:: passed: smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0.00000000e+00]) -Generators.tests.cpp:: failed: unexpected exception with message: 'failure to init' -Exception.tests.cpp:: failed: unexpected exception with message: 'answer := 42' with 1 message: 'expected exception' +Generators.tests.cpp:: failed: unexpected exception with message: 'failure to init'; expression was: {Unknown expression after the reported line} +Exception.tests.cpp:: failed: unexpected exception with message: 'answer := 42'; expression was: {Unknown expression after the reported line} with 1 message: 'expected exception' Exception.tests.cpp:: failed: unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception' Exception.tests.cpp:: passed: thisThrows() with 1 message: 'answer := 42' Compilation.tests.cpp:: passed: 42 == f for: 42 == {?} @@ -2385,7 +2385,7 @@ Exception.tests.cpp:: failed: unexpected exception with message: 'u Exception.tests.cpp:: failed: unexpected exception with message: 'expected exception'; expression was: thisThrows() == 0 Exception.tests.cpp:: failed: unexpected exception with message: 'expected exception'; expression was: thisThrows() == 0 Exception.tests.cpp:: failed: unexpected exception with message: 'expected exception'; expression was: thisThrows() == 0 -Exception.tests.cpp:: failed: unexpected exception with message: 'unexpected exception' +Exception.tests.cpp:: failed: unexpected exception with message: 'unexpected exception'; expression was: {Unknown expression after the reported line} Tricky.tests.cpp:: passed: Tricky.tests.cpp:: passed: Tricky.tests.cpp:: passed: diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt index 92d44a87..b7933236 100644 --- a/tests/SelfTest/Baselines/console.std.approved.txt +++ b/tests/SelfTest/Baselines/console.std.approved.txt @@ -34,6 +34,7 @@ Generators.tests.cpp: ............................................................................... Generators.tests.cpp:: FAILED: + {Unknown expression after the reported line} due to unexpected exception with message: failure to init @@ -45,6 +46,7 @@ Exception.tests.cpp: ............................................................................... Exception.tests.cpp:: FAILED: + {Unknown expression after the reported line} due to unexpected exception with messages: answer := 42 expected exception @@ -1248,6 +1250,7 @@ Exception.tests.cpp: ............................................................................... Exception.tests.cpp:: FAILED: + {Unknown expression after the reported line} due to unexpected exception with message: unexpected exception diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index 414a8881..eb0ea034 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -768,6 +768,7 @@ Generators.tests.cpp: ............................................................................... Generators.tests.cpp:: FAILED: + {Unknown expression after the reported line} due to unexpected exception with message: failure to init @@ -779,6 +780,7 @@ Exception.tests.cpp: ............................................................................... Exception.tests.cpp:: FAILED: + {Unknown expression after the reported line} due to unexpected exception with messages: answer := 42 expected exception @@ -15783,6 +15785,7 @@ Exception.tests.cpp: ............................................................................... Exception.tests.cpp:: FAILED: + {Unknown expression after the reported line} due to unexpected exception with message: unexpected exception diff --git a/tests/SelfTest/Baselines/console.sw.multi.approved.txt b/tests/SelfTest/Baselines/console.sw.multi.approved.txt index cb13b0ff..95f4f6f7 100644 --- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt @@ -766,6 +766,7 @@ Generators.tests.cpp: ............................................................................... Generators.tests.cpp:: FAILED: + {Unknown expression after the reported line} due to unexpected exception with message: failure to init @@ -777,6 +778,7 @@ Exception.tests.cpp: ............................................................................... Exception.tests.cpp:: FAILED: + {Unknown expression after the reported line} due to unexpected exception with messages: answer := 42 expected exception @@ -15776,6 +15778,7 @@ Exception.tests.cpp: ............................................................................... Exception.tests.cpp:: FAILED: + {Unknown expression after the reported line} due to unexpected exception with message: unexpected exception diff --git a/tests/SelfTest/Baselines/console.swa4.approved.txt b/tests/SelfTest/Baselines/console.swa4.approved.txt index 41b7612a..3d181c9f 100644 --- a/tests/SelfTest/Baselines/console.swa4.approved.txt +++ b/tests/SelfTest/Baselines/console.swa4.approved.txt @@ -768,6 +768,7 @@ Generators.tests.cpp: ............................................................................... Generators.tests.cpp:: FAILED: + {Unknown expression after the reported line} due to unexpected exception with message: failure to init @@ -779,6 +780,7 @@ Exception.tests.cpp: ............................................................................... Exception.tests.cpp:: FAILED: + {Unknown expression after the reported line} due to unexpected exception with messages: answer := 42 expected exception diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt index a7bcc914..d4b2ee20 100644 --- a/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -53,8 +53,9 @@ Nor would this - + FAILED: + {Unknown expression after the reported line} failure to init at Generators.tests.cpp: @@ -62,8 +63,9 @@ at Generators.tests.cpp: - + FAILED: + {Unknown expression after the reported line} expected exception answer := 42 at Exception.tests.cpp: @@ -1837,8 +1839,9 @@ at Exception.tests.cpp: - + FAILED: + {Unknown expression after the reported line} unexpected exception at Exception.tests.cpp: diff --git a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt index 20ae2abf..c23dff5b 100644 --- a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt @@ -52,8 +52,9 @@ Nor would this - + FAILED: + {Unknown expression after the reported line} failure to init at Generators.tests.cpp: @@ -61,8 +62,9 @@ at Generators.tests.cpp: - + FAILED: + {Unknown expression after the reported line} expected exception answer := 42 at Exception.tests.cpp: @@ -1836,8 +1838,9 @@ at Exception.tests.cpp: - + FAILED: + {Unknown expression after the reported line} unexpected exception at Exception.tests.cpp: diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt index 915c5a9b..e757c5a4 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -1008,8 +1008,9 @@ at Decomposition.tests.cpp: - + FAILED: + {Unknown expression after the reported line} expected exception answer := 42 at Exception.tests.cpp: @@ -1142,8 +1143,9 @@ at Exception.tests.cpp: - + FAILED: + {Unknown expression after the reported line} unexpected exception at Exception.tests.cpp: @@ -1161,8 +1163,9 @@ at Exception.tests.cpp: - + FAILED: + {Unknown expression after the reported line} failure to init at Generators.tests.cpp: diff --git a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt index cc890873..eb7d7ffb 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt @@ -1007,8 +1007,9 @@ at Decomposition.tests.cpp: - + FAILED: + {Unknown expression after the reported line} expected exception answer := 42 at Exception.tests.cpp: @@ -1141,8 +1142,9 @@ at Exception.tests.cpp: - + FAILED: + {Unknown expression after the reported line} unexpected exception at Exception.tests.cpp: @@ -1160,8 +1162,9 @@ at Exception.tests.cpp: - + FAILED: + {Unknown expression after the reported line} failure to init at Generators.tests.cpp: diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index f1064e6b..08bb5254 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -165,9 +165,9 @@ ok {test-number} - smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) for: 0. # #2152 - ULP checks between differently signed values were wrong - float ok {test-number} - smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0.00000000e+00]) # #2615 - Throwing in constructor generator fails test case but does not abort -not ok {test-number} - unexpected exception with message: 'failure to init' +not ok {test-number} - unexpected exception with message: 'failure to init'; expression was: {Unknown expression after the reported line} # #748 - captures with unexpected exceptions -not ok {test-number} - unexpected exception with message: 'answer := 42' with 1 message: 'expected exception' +not ok {test-number} - unexpected exception with message: 'answer := 42'; expression was: {Unknown expression after the reported line} with 1 message: 'expected exception' # #748 - captures with unexpected exceptions not ok {test-number} - unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception' # #748 - captures with unexpected exceptions @@ -3772,7 +3772,7 @@ not ok {test-number} - unexpected exception with message: 'expected exception'; # When unchecked exceptions are thrown from functions they are always failures not ok {test-number} - unexpected exception with message: 'expected exception'; expression was: thisThrows() == 0 # When unchecked exceptions are thrown from sections they are always failures -not ok {test-number} - unexpected exception with message: 'unexpected exception' +not ok {test-number} - unexpected exception with message: 'unexpected exception'; expression was: {Unknown expression after the reported line} # X/level/0/a ok {test-number} - # X/level/0/b diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt index bdfc9c3b..4181327d 100644 --- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt @@ -163,9 +163,9 @@ ok {test-number} - smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) for: 0. # #2152 - ULP checks between differently signed values were wrong - float ok {test-number} - smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0.00000000e+00]) # #2615 - Throwing in constructor generator fails test case but does not abort -not ok {test-number} - unexpected exception with message: 'failure to init' +not ok {test-number} - unexpected exception with message: 'failure to init'; expression was: {Unknown expression after the reported line} # #748 - captures with unexpected exceptions -not ok {test-number} - unexpected exception with message: 'answer := 42' with 1 message: 'expected exception' +not ok {test-number} - unexpected exception with message: 'answer := 42'; expression was: {Unknown expression after the reported line} with 1 message: 'expected exception' # #748 - captures with unexpected exceptions not ok {test-number} - unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception' # #748 - captures with unexpected exceptions @@ -3765,7 +3765,7 @@ not ok {test-number} - unexpected exception with message: 'expected exception'; # When unchecked exceptions are thrown from functions they are always failures not ok {test-number} - unexpected exception with message: 'expected exception'; expression was: thisThrows() == 0 # When unchecked exceptions are thrown from sections they are always failures -not ok {test-number} - unexpected exception with message: 'unexpected exception' +not ok {test-number} - unexpected exception with message: 'unexpected exception'; expression was: {Unknown expression after the reported line} # X/level/0/a ok {test-number} - # X/level/0/b diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt index ff56cc1c..9b666cc0 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -53,10 +53,10 @@ ##teamcity[testStarted name='#2152 - ULP checks between differently signed values were wrong - float'] ##teamcity[testFinished name='#2152 - ULP checks between differently signed values were wrong - float' duration="{duration}"] ##teamcity[testStarted name='#2615 - Throwing in constructor generator fails test case but does not abort'] -##teamcity[testIgnored name='#2615 - Throwing in constructor generator fails test case but does not abort' message='Generators.tests.cpp:|n...............................................................................|n|nGenerators.tests.cpp:|nunexpected exception with message:|n "failure to init"- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='#2615 - Throwing in constructor generator fails test case but does not abort' message='Generators.tests.cpp:|n...............................................................................|n|nGenerators.tests.cpp:|nunexpected exception with message:|n "failure to init"|n {Unknown expression after the reported line}|nwith expansion:|n {Unknown expression after the reported line}|n- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='#2615 - Throwing in constructor generator fails test case but does not abort' duration="{duration}"] ##teamcity[testStarted name='#748 - captures with unexpected exceptions'] -##teamcity[testIgnored name='#748 - captures with unexpected exceptions' message='-------------------------------------------------------------------------------|noutside assertions|n-------------------------------------------------------------------------------|nException.tests.cpp:|n...............................................................................|n|nException.tests.cpp:|nunexpected exception with messages:|n "answer := 42"|n "expected exception"- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='#748 - captures with unexpected exceptions' message='-------------------------------------------------------------------------------|noutside assertions|n-------------------------------------------------------------------------------|nException.tests.cpp:|n...............................................................................|n|nException.tests.cpp:|nunexpected exception with messages:|n "answer := 42"|n "expected exception"|n {Unknown expression after the reported line}|nwith expansion:|n {Unknown expression after the reported line}|n- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testIgnored name='#748 - captures with unexpected exceptions' message='-------------------------------------------------------------------------------|ninside REQUIRE_NOTHROW|n-------------------------------------------------------------------------------|nException.tests.cpp:|n...............................................................................|n|nException.tests.cpp:|nunexpected exception with messages:|n "answer := 42"|n "expected exception"|n REQUIRE_NOTHROW( thisThrows() )|nwith expansion:|n thisThrows()|n- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='#748 - captures with unexpected exceptions' duration="{duration}"] ##teamcity[testStarted name='#809'] @@ -751,7 +751,7 @@ ##teamcity[testFailed name='When unchecked exceptions are thrown from functions they are always failures' message='Exception.tests.cpp:|n...............................................................................|n|nException.tests.cpp:|nunexpected exception with message:|n "expected exception"|n CHECK( thisThrows() == 0 )|nwith expansion:|n thisThrows() == 0|n'] ##teamcity[testFinished name='When unchecked exceptions are thrown from functions they are always failures' duration="{duration}"] ##teamcity[testStarted name='When unchecked exceptions are thrown from sections they are always failures'] -##teamcity[testFailed name='When unchecked exceptions are thrown from sections they are always failures' message='-------------------------------------------------------------------------------|nsection name|n-------------------------------------------------------------------------------|nException.tests.cpp:|n...............................................................................|n|nException.tests.cpp:|nunexpected exception with message:|n "unexpected exception"'] +##teamcity[testFailed name='When unchecked exceptions are thrown from sections they are always failures' message='-------------------------------------------------------------------------------|nsection name|n-------------------------------------------------------------------------------|nException.tests.cpp:|n...............................................................................|n|nException.tests.cpp:|nunexpected exception with message:|n "unexpected exception"|n {Unknown expression after the reported line}|nwith expansion:|n {Unknown expression after the reported line}|n'] ##teamcity[testFinished name='When unchecked exceptions are thrown from sections they are always failures' duration="{duration}"] ##teamcity[testStarted name='When unchecked exceptions are thrown, but caught, they do not affect the test'] ##teamcity[testFinished name='When unchecked exceptions are thrown, but caught, they do not affect the test' duration="{duration}"] diff --git a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt index 2351d6ce..69b4a760 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt @@ -53,10 +53,10 @@ ##teamcity[testStarted name='#2152 - ULP checks between differently signed values were wrong - float'] ##teamcity[testFinished name='#2152 - ULP checks between differently signed values were wrong - float' duration="{duration}"] ##teamcity[testStarted name='#2615 - Throwing in constructor generator fails test case but does not abort'] -##teamcity[testIgnored name='#2615 - Throwing in constructor generator fails test case but does not abort' message='Generators.tests.cpp:|n...............................................................................|n|nGenerators.tests.cpp:|nunexpected exception with message:|n "failure to init"- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='#2615 - Throwing in constructor generator fails test case but does not abort' message='Generators.tests.cpp:|n...............................................................................|n|nGenerators.tests.cpp:|nunexpected exception with message:|n "failure to init"|n {Unknown expression after the reported line}|nwith expansion:|n {Unknown expression after the reported line}|n- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='#2615 - Throwing in constructor generator fails test case but does not abort' duration="{duration}"] ##teamcity[testStarted name='#748 - captures with unexpected exceptions'] -##teamcity[testIgnored name='#748 - captures with unexpected exceptions' message='-------------------------------------------------------------------------------|noutside assertions|n-------------------------------------------------------------------------------|nException.tests.cpp:|n...............................................................................|n|nException.tests.cpp:|nunexpected exception with messages:|n "answer := 42"|n "expected exception"- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='#748 - captures with unexpected exceptions' message='-------------------------------------------------------------------------------|noutside assertions|n-------------------------------------------------------------------------------|nException.tests.cpp:|n...............................................................................|n|nException.tests.cpp:|nunexpected exception with messages:|n "answer := 42"|n "expected exception"|n {Unknown expression after the reported line}|nwith expansion:|n {Unknown expression after the reported line}|n- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testIgnored name='#748 - captures with unexpected exceptions' message='-------------------------------------------------------------------------------|ninside REQUIRE_NOTHROW|n-------------------------------------------------------------------------------|nException.tests.cpp:|n...............................................................................|n|nException.tests.cpp:|nunexpected exception with messages:|n "answer := 42"|n "expected exception"|n REQUIRE_NOTHROW( thisThrows() )|nwith expansion:|n thisThrows()|n- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='#748 - captures with unexpected exceptions' duration="{duration}"] ##teamcity[testStarted name='#809'] @@ -751,7 +751,7 @@ ##teamcity[testFailed name='When unchecked exceptions are thrown from functions they are always failures' message='Exception.tests.cpp:|n...............................................................................|n|nException.tests.cpp:|nunexpected exception with message:|n "expected exception"|n CHECK( thisThrows() == 0 )|nwith expansion:|n thisThrows() == 0|n'] ##teamcity[testFinished name='When unchecked exceptions are thrown from functions they are always failures' duration="{duration}"] ##teamcity[testStarted name='When unchecked exceptions are thrown from sections they are always failures'] -##teamcity[testFailed name='When unchecked exceptions are thrown from sections they are always failures' message='-------------------------------------------------------------------------------|nsection name|n-------------------------------------------------------------------------------|nException.tests.cpp:|n...............................................................................|n|nException.tests.cpp:|nunexpected exception with message:|n "unexpected exception"'] +##teamcity[testFailed name='When unchecked exceptions are thrown from sections they are always failures' message='-------------------------------------------------------------------------------|nsection name|n-------------------------------------------------------------------------------|nException.tests.cpp:|n...............................................................................|n|nException.tests.cpp:|nunexpected exception with message:|n "unexpected exception"|n {Unknown expression after the reported line}|nwith expansion:|n {Unknown expression after the reported line}|n'] ##teamcity[testFinished name='When unchecked exceptions are thrown from sections they are always failures' duration="{duration}"] ##teamcity[testStarted name='When unchecked exceptions are thrown, but caught, they do not affect the test'] ##teamcity[testFinished name='When unchecked exceptions are thrown, but caught, they do not affect the test' duration="{duration}"] diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index 9dbca924..26996f16 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -668,9 +668,17 @@ Nor would this - - failure to init - + + + {Unknown expression after the reported line} + + + {Unknown expression after the reported line} + + + failure to init + + @@ -678,9 +686,17 @@ Nor would this answer := 42 - - expected exception - + + + {Unknown expression after the reported line} + + + {Unknown expression after the reported line} + + + expected exception + +
@@ -18349,9 +18365,17 @@ Approx( 1.23999999999999999 )
- - unexpected exception - + + + {Unknown expression after the reported line} + + + {Unknown expression after the reported line} + + + unexpected exception + +
diff --git a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt index f68045ac..0223edc1 100644 --- a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt @@ -668,9 +668,17 @@ Nor would this
- - failure to init - + + + {Unknown expression after the reported line} + + + {Unknown expression after the reported line} + + + failure to init + + @@ -678,9 +686,17 @@ Nor would this answer := 42 - - expected exception - + + + {Unknown expression after the reported line} + + + {Unknown expression after the reported line} + + + expected exception + +
@@ -18349,9 +18365,17 @@ Approx( 1.23999999999999999 )
- - unexpected exception - + + + {Unknown expression after the reported line} + + + {Unknown expression after the reported line} + + + unexpected exception + +