diff options
author | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2009-09-16 17:38:08 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2009-09-16 17:38:08 +0000 |
commit | 4bd79e4f25a86f3a2a99f6af06cc43cdacc55853 (patch) | |
tree | 7500e3e892696d384d320f8c6c95320d1e3c58b7 /test/gmock-nice-strict_test.cc | |
parent | f5e1ce5b9237edbc2e524ae9ebcb2452dc842937 (diff) | |
download | googletest-4bd79e4f25a86f3a2a99f6af06cc43cdacc55853.tar.gz googletest-4bd79e4f25a86f3a2a99f6af06cc43cdacc55853.tar.bz2 googletest-4bd79e4f25a86f3a2a99f6af06cc43cdacc55853.zip |
Simplifies the definition of NativeArray. Works around a VC bug in StrictMock & NiceMock.
Diffstat (limited to 'test/gmock-nice-strict_test.cc')
-rw-r--r-- | test/gmock-nice-strict_test.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/gmock-nice-strict_test.cc b/test/gmock-nice-strict_test.cc index 955961c5..15984a55 100644 --- a/test/gmock-nice-strict_test.cc +++ b/test/gmock-nice-strict_test.cc @@ -36,6 +36,13 @@ #include <gtest/gtest.h> #include <gtest/gtest-spi.h> +// This must not be defined inside the ::testing namespace, or it will +// clash with ::testing::Mock. +class Mock { + public: + MOCK_METHOD0(DoThis, void()); +}; + namespace testing { namespace gmock_nice_strict_test { @@ -166,6 +173,17 @@ TEST(NiceMockTest, NonDefaultConstructor10) { nice_bar.That(5, true); } +// Tests that NiceMock<Mock> compiles where Mock is a user-defined +// class (as opposed to ::testing::Mock). We had to workaround an +// MSVC 8.0 bug that caused the symbol Mock used in the definition of +// NiceMock to be looked up in the wrong context, and this test +// ensures that our fix works. +TEST(NiceMockTest, AcceptsClassNamedMock) { + NiceMock< ::Mock> nice; + EXPECT_CALL(nice, DoThis()); + nice.DoThis(); +} + // Tests that a strict mock allows expected calls. TEST(StrictMockTest, AllowsExpectedCall) { StrictMock<MockFoo> strict_foo; @@ -224,5 +242,16 @@ TEST(StrictMockTest, NonDefaultConstructor10) { "Uninteresting mock function call"); } +// Tests that StrictMock<Mock> compiles where Mock is a user-defined +// class (as opposed to ::testing::Mock). We had to workaround an +// MSVC 8.0 bug that caused the symbol Mock used in the definition of +// StrictMock to be looked up in the wrong context, and this test +// ensures that our fix works. +TEST(StrictMockTest, AcceptsClassNamedMock) { + StrictMock< ::Mock> nice; + EXPECT_CALL(nice, DoThis()); + nice.DoThis(); +} + } // namespace gmock_nice_strict_test } // namespace testing |