From 42abea350d4f26a006f760fae0d1f9882deb9221 Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Tue, 5 May 2009 23:13:43 +0000 Subject: Uses DebugBreak() to properly break on Windows (by Vlad Losev). --- src/gtest.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/gtest.cc b/src/gtest.cc index 48807671..6fc4044d 100644 --- a/src/gtest.cc +++ b/src/gtest.cc @@ -3312,7 +3312,14 @@ void UnitTest::AddTestPartResult(TestPartResultType result_type, // with another testing framework) and specify the former on the // command line for debugging. if (GTEST_FLAG(break_on_failure)) { +#if GTEST_OS_WINDOWS + // Using DebugBreak on Windows allows gtest to still break into a debugger + // when a failure happens and both the --gtest_break_on_failure and + // the --gtest_catch_exceptions flags are specified. + DebugBreak(); +#else *static_cast(NULL) = 1; +#endif // GTEST_OS_WINDOWS } else if (GTEST_FLAG(throw_on_failure)) { #if GTEST_HAS_EXCEPTIONS throw GoogleTestFailureException(result); -- cgit v1.2.3