mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-03 13:55:39 +02:00
Fix bad error reporting for nested exceptions in default configuration
Bad handling of `TestFailureException` when translating unexpected exceptions inside assertion macros led to the unexpected exceptions handling erroring out through throwing the same exception again. This was then backstopped by the machinery for handling uncaught exceptions from assertions, which is normally used by the `CATCH_CONFIG_FAST_COMPILE` machinery, where we assume that it can only be invoked because the assertion macros are not configured to catch assertions. Closes #1292
This commit is contained in:
@@ -2564,6 +2564,41 @@ Compilation.tests.cpp:<line number>: PASSED:
|
||||
with expansion:
|
||||
!(Val: 1 ^ Val: 1)
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Assertions can be nested - CHECK
|
||||
-------------------------------------------------------------------------------
|
||||
AssertionHandler.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
AssertionHandler.tests.cpp:<line number>: FAILED:
|
||||
REQUIRE( i > 10 )
|
||||
with expansion:
|
||||
2 > 10
|
||||
|
||||
AssertionHandler.tests.cpp:<line number>: FAILED:
|
||||
CHECK( foo( 2 ) == 2 )
|
||||
due to unexpected exception with message:
|
||||
{ nested assertion failed }
|
||||
|
||||
AssertionHandler.tests.cpp:<line number>: PASSED:
|
||||
CHECK( true )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Assertions can be nested - REQUIRE
|
||||
-------------------------------------------------------------------------------
|
||||
AssertionHandler.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
AssertionHandler.tests.cpp:<line number>: FAILED:
|
||||
REQUIRE( i > 10 )
|
||||
with expansion:
|
||||
2 > 10
|
||||
|
||||
AssertionHandler.tests.cpp:<line number>: FAILED:
|
||||
REQUIRE( foo( 2 ) == 2 )
|
||||
due to unexpected exception with message:
|
||||
{ nested assertion failed }
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Assertions then sections
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -4559,6 +4594,21 @@ Message.tests.cpp:<line number>: FAILED:
|
||||
explicitly with message:
|
||||
This is a failure
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
FAIL can be nested in assertion
|
||||
-------------------------------------------------------------------------------
|
||||
AssertionHandler.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
AssertionHandler.tests.cpp:<line number>: FAILED:
|
||||
explicitly with message:
|
||||
Throw a Catch::TestFailureException
|
||||
|
||||
AssertionHandler.tests.cpp:<line number>: FAILED:
|
||||
CHECK_NOTHROW( do_fail() )
|
||||
due to unexpected exception with message:
|
||||
{ nested assertion failed }
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
FAIL does not require an argument
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -19123,6 +19173,6 @@ Misc.tests.cpp:<line number>
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 428 | 313 passed | 95 failed | 6 skipped | 14 failed as expected
|
||||
assertions: 2281 | 2089 passed | 157 failed | 35 failed as expected
|
||||
test cases: 431 | 313 passed | 95 failed | 6 skipped | 17 failed as expected
|
||||
assertions: 2288 | 2090 passed | 157 failed | 41 failed as expected
|
||||
|
||||
|
Reference in New Issue
Block a user