diff options
author | James Dennett <jdennett@google.com> | 2018-05-21 17:57:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-21 17:57:01 (GMT) |
commit | 89286a4cdf503c421c6156af19a6013b7d4a98c9 (patch) | |
tree | 4779f3f0c759c4f2fe2643cd45151dbae7e0b1a2 /googletest/test/gtest_unittest.cc | |
parent | 54e331b88bca8e9ab9de55153a3e6d295299aad0 (diff) | |
parent | 08d5b1f33af8c18785fb8ca02792b5fac81e248f (diff) | |
download | googletest-89286a4cdf503c421c6156af19a6013b7d4a98c9.zip googletest-89286a4cdf503c421c6156af19a6013b7d4a98c9.tar.gz googletest-89286a4cdf503c421c6156af19a6013b7d4a98c9.tar.bz2 |
Merge branch 'master' into StdLibVersioning
Diffstat (limited to 'googletest/test/gtest_unittest.cc')
-rw-r--r-- | googletest/test/gtest_unittest.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index 2b5a7e1..662a8ab 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -7773,3 +7773,25 @@ TEST(SkipPrefixTest, DoesNotSkipWhenPrefixDoesNotMatch) { EXPECT_FALSE(SkipPrefix("world!", &p)); EXPECT_EQ(str, p); } + +// Tests ad_hoc_test_result(). + +class AdHocTestResultTest : public testing::Test { + protected: + static void SetUpTestCase() { + FAIL() << "A failure happened inside SetUpTestCase()."; + } +}; + +TEST_F(AdHocTestResultTest, AdHocTestResultForTestCaseShowsFailure) { + const testing::TestResult& test_result = testing::UnitTest::GetInstance() + ->current_test_case() + ->ad_hoc_test_result(); + EXPECT_TRUE(test_result.Failed()); +} + +TEST_F(AdHocTestResultTest, AdHocTestResultTestForUnitTestDoesNotShowFailure) { + const testing::TestResult& test_result = + testing::UnitTest::GetInstance()->ad_hoc_test_result(); + EXPECT_FALSE(test_result.Failed()); +} |