diff options
author | Dino Radakovic <dinor@google.com> | 2022-08-08 18:47:36 (GMT) |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-08-08 18:48:12 (GMT) |
commit | 4c9a3bb62bf3ba1f1010bf96f9c8ed767b363774 (patch) | |
tree | a87c706e82ac59329b274a914417fb7dd46ba1cc /googletest | |
parent | 5b909beeec178f338be997830b6c31a80cda7a93 (diff) | |
download | googletest-4c9a3bb62bf3ba1f1010bf96f9c8ed767b363774.zip googletest-4c9a3bb62bf3ba1f1010bf96f9c8ed767b363774.tar.gz googletest-4c9a3bb62bf3ba1f1010bf96f9c8ed767b363774.tar.bz2 |
gtest_unittest: Call FAIL() in lambda, fix incorrect fatality expectation
FAIL() evaluates into a return statement: https://github.com/google/googletest/blob/5b909beeec178f338be997830b6c31a80cda7a93/googletest/include/gtest/internal/gtest-internal.h#L1347
Calling it from the body of the test case turns all subsequent expectations into no-ops.
Fixes #3941
PiperOrigin-RevId: 466104977
Change-Id: Ic15f43acb734295a5c9690a2b5eec6f65e8c0814
Diffstat (limited to 'googletest')
-rw-r--r-- | googletest/test/gtest_unittest.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index b579e81..329ca54 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -3454,10 +3454,10 @@ TEST_F(NoFatalFailureTest, MessageIsStreamable) { TestPartResultArray gtest_failures; { ScopedFakeTestPartResultReporter gtest_reporter(>est_failures); - EXPECT_NO_FATAL_FAILURE(FAIL() << "foo") << "my message"; + EXPECT_NO_FATAL_FAILURE([] { FAIL() << "foo"; }()) << "my message"; } ASSERT_EQ(2, gtest_failures.size()); - EXPECT_EQ(TestPartResult::kNonFatalFailure, + EXPECT_EQ(TestPartResult::kFatalFailure, gtest_failures.GetTestPartResult(0).type()); EXPECT_EQ(TestPartResult::kNonFatalFailure, gtest_failures.GetTestPartResult(1).type()); |