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

@@ -1,6 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- filters='"*" ~[!nonportable] ~[!benchmark] ~[approvals]' rng-seed=1 -->
<testExecutions version="1">
<file path="tests/<exe-name>/IntrospectiveTests/AssertionHandler.tests.cpp">
<testCase name="Incomplete AssertionHandler" duration="{duration}">
<skipped message="REQUIRE(Dummy)">
FAILED:
REQUIRE( Dummy )
Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE
at AssertionHandler.tests.cpp:<line number>
</skipped>
</testCase>
</file>
<file path="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp">
<testCase name="Clara::Arg supports single-arg parse the way Opt does" duration="{duration}"/>
<testCase name="Clara::Opt supports accept-many lambdas/Parsing fails on multiple options without accept_many" duration="{duration}"/>
@@ -1726,6 +1736,22 @@ at Misc.tests.cpp:<line number>
<testCase name="Testing checked-if 3" duration="{duration}">
<skipped message="FAIL()">
FAILED:
at Misc.tests.cpp:<line number>
</skipped>
</testCase>
<testCase name="Testing checked-if 4" duration="{duration}">
<skipped message="({Unknown expression after the reported line})">
FAILED:
{Unknown expression after the reported line}
Uncaught exception should fail!
at Misc.tests.cpp:<line number>
</skipped>
</testCase>
<testCase name="Testing checked-if 5" duration="{duration}">
<skipped message="({Unknown expression after the reported line})">
FAILED:
{Unknown expression after the reported line}
Uncaught exception should fail!
at Misc.tests.cpp:<line number>
</skipped>
</testCase>