[#4294] --gtest_break_on_failure updated condition to not effect throw_on_failure. Updated googletest-throw-on-failure-test_.cc to set the throw_on_failure mode.
This commit is contained in:
parent
2888f75afd
commit
553c2d5dd7
@ -5342,14 +5342,14 @@ void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
|
|||||||
result);
|
result);
|
||||||
|
|
||||||
if (result_type != TestPartResult::kSuccess &&
|
if (result_type != TestPartResult::kSuccess &&
|
||||||
result_type != TestPartResult::kSkip &&
|
result_type != TestPartResult::kSkip) {
|
||||||
result_type != TestPartResult::kNonFatalFailure) {
|
|
||||||
// gtest_break_on_failure takes precedence over
|
// gtest_break_on_failure takes precedence over
|
||||||
// gtest_throw_on_failure. This allows a user to set the latter
|
// gtest_throw_on_failure. This allows a user to set the latter
|
||||||
// in the code (perhaps in order to use Google Test assertions
|
// in the code (perhaps in order to use Google Test assertions
|
||||||
// with another testing framework) and specify the former on the
|
// with another testing framework) and specify the former on the
|
||||||
// command line for debugging.
|
// command line for debugging.
|
||||||
if (GTEST_FLAG_GET(break_on_failure)) {
|
if (GTEST_FLAG_GET(break_on_failure) &&
|
||||||
|
result_type != TestPartResult::kNonFatalFailure) {
|
||||||
#if defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_WINDOWS_PHONE) && \
|
#if defined(GTEST_OS_WINDOWS) && !defined(GTEST_OS_WINDOWS_PHONE) && \
|
||||||
!defined(GTEST_OS_WINDOWS_RT)
|
!defined(GTEST_OS_WINDOWS_RT)
|
||||||
// Using DebugBreak on Windows allows gtest to still break into a debugger
|
// Using DebugBreak on Windows allows gtest to still break into a debugger
|
||||||
|
@ -54,6 +54,7 @@ int main(int argc, char** argv) {
|
|||||||
std::set_terminate(&TerminateHandler);
|
std::set_terminate(&TerminateHandler);
|
||||||
#endif
|
#endif
|
||||||
testing::InitGoogleTest(&argc, argv);
|
testing::InitGoogleTest(&argc, argv);
|
||||||
|
GTEST_FLAG_SET(throw_on_failure, true);
|
||||||
|
|
||||||
// We want to ensure that people can use Google Test assertions in
|
// We want to ensure that people can use Google Test assertions in
|
||||||
// other testing frameworks, as long as they initialize Google Test
|
// other testing frameworks, as long as they initialize Google Test
|
||||||
|
Loading…
Reference in New Issue
Block a user