From 67a240a107888c0d3baba528f05820dcc8ac737f Mon Sep 17 00:00:00 2001 From: Jonathan Wendeborn Date: Tue, 16 Oct 2018 08:07:15 +0200 Subject: Added Mock::IsNaggy, IsNice, and IsStrict --- googlemock/test/gmock-nice-strict_test.cc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'googlemock/test') diff --git a/googlemock/test/gmock-nice-strict_test.cc b/googlemock/test/gmock-nice-strict_test.cc index d0adcbbe..78f3b515 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 nice_foo; @@ -253,6 +262,13 @@ TEST(NiceMockTest, AcceptsClassNamedMock) { } #endif // !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE +TEST(NiceMockTest, IsNaggy_IsNice_IsStrict) { + NiceMock 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 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 strict_foo; @@ -420,5 +443,12 @@ TEST(StrictMockTest, AcceptsClassNamedMock) { } #endif // !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE +TEST(StrictMockTest, IsNaggy_IsNice_IsStrict) { + StrictMock 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 -- cgit v1.2.3 From 6bbf911a8dc0c42ad05135f26a07f4893eb83916 Mon Sep 17 00:00:00 2001 From: Jonathan Wendeborn Date: Tue, 16 Oct 2018 08:19:02 +0200 Subject: Don't fully qualify enum member --- googlemock/test/gmock-nice-strict_test.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'googlemock/test') diff --git a/googlemock/test/gmock-nice-strict_test.cc b/googlemock/test/gmock-nice-strict_test.cc index 78f3b515..38daee0b 100644 --- a/googlemock/test/gmock-nice-strict_test.cc +++ b/googlemock/test/gmock-nice-strict_test.cc @@ -161,9 +161,8 @@ TEST(RawMockTest, InfoForUninterestingCall) { } TEST(RawMockTest, IsNaggy_IsNice_IsStrict) { - using internal::CallReaction; MockFoo raw_foo; - ASSERT_EQ(CallReaction::kDefault, CallReaction::kWarn) << "precondition"; + ASSERT_EQ(internal::kDefault, internal::kWarn) << "precondition"; EXPECT_TRUE (Mock::IsNaggy(&raw_foo)); EXPECT_FALSE(Mock::IsNice(&raw_foo)); EXPECT_FALSE(Mock::IsStrict(&raw_foo)); -- cgit v1.2.3 From 0cefda7749756806445a9caab4d8517c808f61f6 Mon Sep 17 00:00:00 2001 From: Jonathan Wendeborn Date: Tue, 16 Oct 2018 08:51:33 +0200 Subject: Removed last reference to internal::kDefault --- googlemock/test/gmock-nice-strict_test.cc | 1 - 1 file changed, 1 deletion(-) (limited to 'googlemock/test') diff --git a/googlemock/test/gmock-nice-strict_test.cc b/googlemock/test/gmock-nice-strict_test.cc index 9cae9872..b08998a7 100644 --- a/googlemock/test/gmock-nice-strict_test.cc +++ b/googlemock/test/gmock-nice-strict_test.cc @@ -186,7 +186,6 @@ TEST(RawMockTest, InfoForUninterestingCall) { TEST(RawMockTest, IsNaggy_IsNice_IsStrict) { MockFoo raw_foo; - ASSERT_EQ(internal::kDefault, internal::kWarn) << "precondition"; EXPECT_TRUE (Mock::IsNaggy(&raw_foo)); EXPECT_FALSE(Mock::IsNice(&raw_foo)); EXPECT_FALSE(Mock::IsStrict(&raw_foo)); -- cgit v1.2.3