mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 05:59:32 +01:00 
			
		
		
		
	Fix issue with Address Sanitizer on Windows.
This commit is contained in:
		@@ -7,6 +7,7 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "catch.hpp"
 | 
			
		||||
#include <catch2/internal/catch_windows_h_proxy.hpp>
 | 
			
		||||
 | 
			
		||||
#ifdef __clang__
 | 
			
		||||
#   pragma clang diagnostic ignored "-Wc++98-compat"
 | 
			
		||||
@@ -491,3 +492,34 @@ TEMPLATE_TEST_CASE_SIG("#1954 - 7 arg template test case sig compiles", "[regres
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}} // namespace MiscTests
 | 
			
		||||
 | 
			
		||||
#if defined(CATCH_PLATFORM_WINDOWS)
 | 
			
		||||
void throw_and_catch()
 | 
			
		||||
{
 | 
			
		||||
    __try {
 | 
			
		||||
        RaiseException(0xC0000005, 0, 0, NULL);
 | 
			
		||||
    }
 | 
			
		||||
    __except (1)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST_CASE("Validate SEH behavior - handled", "[approvals][FatalConditionHandler][CATCH_PLATFORM_WINDOWS]")
 | 
			
		||||
{
 | 
			
		||||
    // Validate that Catch2 framework correctly handles tests raising and handling SEH exceptions.
 | 
			
		||||
    throw_and_catch();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void throw_no_catch()
 | 
			
		||||
{
 | 
			
		||||
    RaiseException(0xC0000005, 0, 0, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST_CASE("Validate SEH behavior - unhandled", "[.approvals][FatalConditionHandler][CATCH_PLATFORM_WINDOWS]")
 | 
			
		||||
{
 | 
			
		||||
    // Validate that Catch2 framework correctly handles tests raising and not handling SEH exceptions.
 | 
			
		||||
    throw_no_catch();
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user