catch3
Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.
Clonegit clone https://git.progmasoft.com/catch3
Add test for `FatalConditionHandler` and stack unwinding
- Commit
cf6dd937ab2ff62d29b34d62411cfd03d3822021- Author
- Kochetkov, Yuriy ·
- Committer
- Martin Hořeňovský
- Parents
2ce64d1d8f26
Changes
tests/SelfTest/UsageTests/Misc.tests.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/SelfTest/UsageTests/Misc.tests.cpp b/tests/SelfTest/UsageTests/Misc.tests.cpp index cf608dd9..33734d43 100644 --- a/tests/SelfTest/UsageTests/Misc.tests.cpp +++ b/tests/SelfTest/UsageTests/Misc.tests.cpp @@ -537,4 +537,16 @@ TEST_CASE("Validate SEH behavior - unhandled", "[.approvals][FatalConditionHandl // Validate that Catch2 framework correctly handles tests raising and not handling SEH exceptions. throw_no_catch(); } + +static LONG CALLBACK dummyExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo) { + return EXCEPTION_CONTINUE_SEARCH; +} + +TEST_CASE("Validate SEH behavior - no crash for stack unwinding", "[approvals][!throws][!shouldfail][FatalConditionHandler][CATCH_PLATFORM_WINDOWS]") +{ + // Trigger stack unwinding with SEH top-level filter changed and validate the test fails expectedly with no application crash + SetUnhandledExceptionFilter(dummyExceptionFilter); + throw 1; +} + #endif