Assert Info reset need to also reset result disposition to normal to handle uncaught exception correctly (#2723)

* AssertionEnd does not reset the assertion info yet. That is done after populateReaction. And reset assertion info would also reset the result disposition to normal, so that any uncaught exception would be reported as failure

* Approving test output changes due to added unit tests

* Unit tests to throw std::runtime_error instead of std::exception

* Add a unit test to test incomplete assertion handler

---------

Co-authored-by: Ross <ross.tang@gfo-x.com>
This commit is contained in:
rosstang
2023-08-08 04:07:31 +08:00
committed by GitHub
parent b593be2116
commit cd60a0301c
21 changed files with 445 additions and 20 deletions

View File

@@ -8619,6 +8619,20 @@ C
</Expression>
<OverallResult success="false" skips="0"/>
</TestCase>
<TestCase name="Incomplete AssertionHandler" tags="[!shouldfail][assertion-handler]" filename="tests/<exe-name>/IntrospectiveTests/AssertionHandler.tests.cpp" >
<Expression success="false" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/AssertionHandler.tests.cpp" >
<Original>
Dummy
</Original>
<Expanded>
Dummy
</Expanded>
<Exception filename="tests/<exe-name>/IntrospectiveTests/AssertionHandler.tests.cpp" >
Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE
</Exception>
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Inequality checks that should fail" tags="[!shouldfail][.][failing]" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" >
<Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" >
<Original>
@@ -14547,6 +14561,50 @@ Message from section two
<Failure filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" />
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Testing checked-if 4" tags="[!shouldfail][checked-if]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Expression success="true" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
true
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="false" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
{Unknown expression after the reported line}
</Original>
<Expanded>
{Unknown expression after the reported line}
</Expanded>
<Exception filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
Uncaught exception should fail!
</Exception>
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="Testing checked-if 5" tags="[!shouldfail][checked-if]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Expression success="false" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<Expression success="false" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original>
{Unknown expression after the reported line}
</Original>
<Expanded>
{Unknown expression after the reported line}
</Expanded>
<Exception filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" >
Uncaught exception should fail!
</Exception>
</Expression>
<OverallResult success="true" skips="0"/>
</TestCase>
<TestCase name="The NO_FAIL macro reports a failure but does not fail the test" tags="[messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Expression success="false" type="CHECK_NOFAIL" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
@@ -21198,6 +21256,6 @@ b1!
</Section>
<OverallResult success="true" skips="0"/>
</TestCase>
<OverallResults successes="2048" failures="145" expectedFailures="32" skips="12"/>
<OverallResultsCases successes="308" failures="84" expectedFailures="11" skips="6"/>
<OverallResults successes="2049" failures="145" expectedFailures="35" skips="12"/>
<OverallResultsCases successes="308" failures="84" expectedFailures="14" skips="6"/>
</Catch2TestRun>