mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-02 13:25:41 +02:00
Only track the last line info in RunContext
There were only two places where we used the full `AssertionInfo` instance in `m_lastAssertionInfo`: 1) when reporting unexpected exception from running a test case 2) when reporting fatal error because in those two places we do not have access to a real instance of `AssertionInfo`, but we still need to send one to the reporters. As a bonus, in both of these places we were already constructing a fake-ish assertion info, by using the last encountered source location, but dummying out the other information. Instead, we only keep track of the last encountered source location, and construct the dummy `AssertionInfo` on-demand. This finishes the set of refactoring around `m_lastAssertionInfo` in `RunContext` and improves the performance of running assertions by ~5% in both Debug and Release mode. -------------- Note that this change also causes small difference in output. It could be avoided by having an invalidation flag and tracking where the information would be invalidated before, but the difference includes more precise line location for unexpected errors (both exceptions and fatals), so I prefer the new output.
This commit is contained in:
@@ -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:<line number>|n...............................................................................|n|nGenerators.tests.cpp:<line number>|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:<line number>|n...............................................................................|n|nGenerators.tests.cpp:<line number>|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:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|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:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|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:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|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:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|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:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|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:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|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}"]
|
||||
|
Reference in New Issue
Block a user