summaryrefslogtreecommitdiffstats
path: root/googlemock/test
diff options
context:
space:
mode:
authorJonathan Wendeborn <jonathan.wendeborn@bruker.com>2018-10-16 06:07:15 (GMT)
committerJonathan Wendeborn <jonathan.wendeborn@bruker.com>2018-10-16 06:07:15 (GMT)
commit67a240a107888c0d3baba528f05820dcc8ac737f (patch)
treea8bcf64d3a65da74a154a9bb719f2f1a71312abe /googlemock/test
parentecd530865cefdfa7dea58e84f6aa1b548950363d (diff)
downloadgoogletest-67a240a107888c0d3baba528f05820dcc8ac737f.zip
googletest-67a240a107888c0d3baba528f05820dcc8ac737f.tar.gz
googletest-67a240a107888c0d3baba528f05820dcc8ac737f.tar.bz2
Added Mock::IsNaggy, IsNice, and IsStrict
Diffstat (limited to 'googlemock/test')
-rw-r--r--googlemock/test/gmock-nice-strict_test.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/googlemock/test/gmock-nice-strict_test.cc b/googlemock/test/gmock-nice-strict_test.cc
index d0adcbb..78f3b51 100644
--- a/googlemock/test/gmock-nice-strict_test.cc
+++ b/googlemock/test/gmock-nice-strict_test.cc
@@ -160,6 +160,15 @@ TEST(RawMockTest, InfoForUninterestingCall) {
GMOCK_FLAG(verbose) = saved_flag;
}
+TEST(RawMockTest, IsNaggy_IsNice_IsStrict) {
+ using internal::CallReaction;
+ MockFoo raw_foo;
+ ASSERT_EQ(CallReaction::kDefault, CallReaction::kWarn) << "precondition";
+ EXPECT_TRUE (Mock::IsNaggy(&raw_foo));
+ EXPECT_FALSE(Mock::IsNice(&raw_foo));
+ EXPECT_FALSE(Mock::IsStrict(&raw_foo));
+}
+
// Tests that a nice mock generates no warning for uninteresting calls.
TEST(NiceMockTest, NoWarningForUninterestingCall) {
NiceMock<MockFoo> nice_foo;
@@ -253,6 +262,13 @@ TEST(NiceMockTest, AcceptsClassNamedMock) {
}
#endif // !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
+TEST(NiceMockTest, IsNaggy_IsNice_IsStrict) {
+ NiceMock<MockFoo> nice_foo;
+ EXPECT_FALSE(Mock::IsNaggy(&nice_foo));
+ EXPECT_TRUE (Mock::IsNice(&nice_foo));
+ EXPECT_FALSE(Mock::IsStrict(&nice_foo));
+}
+
#if GTEST_HAS_STREAM_REDIRECTION
// Tests that a naggy mock generates warnings for uninteresting calls.
@@ -346,6 +362,13 @@ TEST(NaggyMockTest, AcceptsClassNamedMock) {
}
#endif // !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
+TEST(NaggyMockTest, IsNaggy_IsNice_IsStrict) {
+ NaggyMock<MockFoo> naggy_foo;
+ EXPECT_TRUE (Mock::IsNaggy(&naggy_foo));
+ EXPECT_FALSE(Mock::IsNice(&naggy_foo));
+ EXPECT_FALSE(Mock::IsStrict(&naggy_foo));
+}
+
// Tests that a strict mock allows expected calls.
TEST(StrictMockTest, AllowsExpectedCall) {
StrictMock<MockFoo> strict_foo;
@@ -420,5 +443,12 @@ TEST(StrictMockTest, AcceptsClassNamedMock) {
}
#endif // !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
+TEST(StrictMockTest, IsNaggy_IsNice_IsStrict) {
+ StrictMock<MockFoo> strict_foo;
+ EXPECT_FALSE(Mock::IsNaggy(&strict_foo));
+ EXPECT_FALSE(Mock::IsNice(&strict_foo));
+ EXPECT_TRUE (Mock::IsStrict(&strict_foo));
+}
+
} // namespace gmock_nice_strict_test
} // namespace testing