summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordurandal <durandal@google.com>2018-11-28 21:40:09 (GMT)
committerGennadiy Civil <misterg@google.com>2018-11-29 04:10:23 (GMT)
commit8fbf9d16a63a8b0cd629b24089f9470deef75120 (patch)
tree39146d6e6e9e7118092fe7f1e3f7d564e5f59e3f
parentb22d23667b6066441e869480e046c170d4bdc6ec (diff)
downloadgoogletest-8fbf9d16a63a8b0cd629b24089f9470deef75120.zip
googletest-8fbf9d16a63a8b0cd629b24089f9470deef75120.tar.gz
googletest-8fbf9d16a63a8b0cd629b24089f9470deef75120.tar.bz2
Googletest export
Fix: remove two added testcases that depend on gmock; I'll put them back later in a way that doesn't break the build. PiperOrigin-RevId: 223227562
-rw-r--r--googletest/test/googletest-death-test-test.cc34
1 files changed, 11 insertions, 23 deletions
diff --git a/googletest/test/googletest-death-test-test.cc b/googletest/test/googletest-death-test-test.cc
index 59581d6..5d87e1a 100644
--- a/googletest/test/googletest-death-test-test.cc
+++ b/googletest/test/googletest-death-test-test.cc
@@ -32,7 +32,6 @@
#include "gtest/gtest-death-test.h"
-#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "gtest/internal/gtest-filepath.h"
@@ -61,7 +60,7 @@ using testing::internal::AlwaysTrue;
namespace posix = ::testing::internal::posix;
-using testing::HasSubstr;
+using testing::ContainsRegex;
using testing::Matcher;
using testing::Message;
using testing::internal::DeathTest;
@@ -303,14 +302,14 @@ TEST_F(TestForDeathTest, SingleStatement) {
EXPECT_DEATH(_exit(1), "") << 1 << 2 << 3;
}
+# if GTEST_USES_PCRE
+
void DieWithEmbeddedNul() {
fprintf(stderr, "Hello%cmy null world.\n", '\0');
fflush(stderr);
_exit(1);
}
-# if GTEST_USES_PCRE
-
// Tests that EXPECT_DEATH and ASSERT_DEATH work when the error
// message has a NUL character in it.
TEST_F(TestForDeathTest, EmbeddedNulInMessage) {
@@ -1340,38 +1339,27 @@ TEST(MatcherDeathTest, DoesNotBreakBareRegexMatching) {
TEST(MatcherDeathTest, MonomorphicMatcherMatches) {
EXPECT_DEATH(DieWithMessage("Behind O, I am slain!"),
- Matcher<const std::string&>(HasSubstr("I am slain")));
+ Matcher<const std::string&>(ContainsRegex("I am slain")));
}
TEST(MatcherDeathTest, MonomorphicMatcherDoesNotMatch) {
EXPECT_NONFATAL_FAILURE(
- EXPECT_DEATH(DieWithMessage("Behind O, I am slain!"),
- Matcher<const std::string&>(HasSubstr("Ow, I am slain"))),
- "Expected: has substring \"Ow, I am slain\"");
+ EXPECT_DEATH(
+ DieWithMessage("Behind O, I am slain!"),
+ Matcher<const std::string&>(ContainsRegex("Ow, I am slain"))),
+ "Expected: contains regular expression \"Ow, I am slain\"");
}
TEST(MatcherDeathTest, PolymorphicMatcherMatches) {
EXPECT_DEATH(DieWithMessage("The rest is silence."),
- HasSubstr("rest is silence"));
+ ContainsRegex("rest is silence"));
}
TEST(MatcherDeathTest, PolymorphicMatcherDoesNotMatch) {
- EXPECT_NONFATAL_FAILURE(EXPECT_DEATH(DieWithMessage("The rest is silence."),
- HasSubstr("rest is science")),
- "Expected: has substring \"rest is science\"");
-}
-
-TEST(MatcherDeathTest, CompositeMatcherMatches) {
- EXPECT_DEATH(DieWithMessage("Et tu, Brute! Then fall, Caesar."),
- AllOf(HasSubstr("Et tu"), HasSubstr("fall, Caesar")));
-}
-
-TEST(MatcherDeathTest, CompositeMatcherDoesNotMatch) {
EXPECT_NONFATAL_FAILURE(
EXPECT_DEATH(DieWithMessage("The rest is silence."),
- AnyOf(HasSubstr("Eat two"), HasSubstr("lol Caesar"))),
- "Expected: (has substring \"Eat two\") or "
- "(has substring \"lol Caesar\")");
+ ContainsRegex("rest is science")),
+ "Expected: contains regular expression \"rest is science\"");
}
} // namespace