diff options
author | kosak <kosak@google.com> | 2014-01-13 22:28:01 +0000 |
---|---|---|
committer | kosak <kosak@google.com> | 2014-01-13 22:28:01 +0000 |
commit | b93d0f10d5a1bab088223a57420ef599b26a5e0f (patch) | |
tree | 87ef35fe99962b8de504902528d8be44a58b1450 /test | |
parent | 04ce8521f481d857db1aa00a206278759b9b0381 (diff) | |
download | googletest-b93d0f10d5a1bab088223a57420ef599b26a5e0f.tar.gz googletest-b93d0f10d5a1bab088223a57420ef599b26a5e0f.tar.bz2 googletest-b93d0f10d5a1bab088223a57420ef599b26a5e0f.zip |
Make Google Mock build cleanly on Visual Studio 2010, 2012, 2013.
Diffstat (limited to 'test')
-rw-r--r-- | test/gmock-generated-function-mockers_test.cc | 11 | ||||
-rw-r--r-- | test/gmock-more-actions_test.cc | 22 |
2 files changed, 22 insertions, 11 deletions
diff --git a/test/gmock-generated-function-mockers_test.cc b/test/gmock-generated-function-mockers_test.cc index ea49b9c1..169ed5a2 100644 --- a/test/gmock-generated-function-mockers_test.cc +++ b/test/gmock-generated-function-mockers_test.cc @@ -112,6 +112,14 @@ class FooInterface { #endif // GTEST_OS_WINDOWS }; +// Const qualifiers on arguments were once (incorrectly) considered +// significant in determining whether two virtual functions had the same +// signature. This was fixed in Visual Studio 2008. However, the compiler +// still emits a warning that alerts about this change in behavior. +#ifdef _MSC_VER +# pragma warning(push) +# pragma warning(disable : 4373) +#endif class MockFoo : public FooInterface { public: MockFoo() {} @@ -167,6 +175,9 @@ class MockFoo : public FooInterface { private: GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo); }; +#ifdef _MSC_VER +# pragma warning(pop) +#endif class FunctionMockerTest : public testing::Test { protected: diff --git a/test/gmock-more-actions_test.cc b/test/gmock-more-actions_test.cc index 9dde5ebb..eb516d22 100644 --- a/test/gmock-more-actions_test.cc +++ b/test/gmock-more-actions_test.cc @@ -668,17 +668,17 @@ TEST(SetArrayArgumentTest, SetsTheNthArrayWithEmptyRange) { // Tests SetArrayArgument<N>(first, last) where *first is convertible // (but not equal) to the argument type. TEST(SetArrayArgumentTest, SetsTheNthArrayWithConvertibleType) { - typedef void MyFunction(bool, char*); - int codes[] = { 97, 98, 99 }; - Action<MyFunction> a = SetArrayArgument<1>(codes, codes + 3); - - char ch[4] = {}; - char* pch = ch; - a.Perform(make_tuple(true, pch)); - EXPECT_EQ('a', ch[0]); - EXPECT_EQ('b', ch[1]); - EXPECT_EQ('c', ch[2]); - EXPECT_EQ('\0', ch[3]); + typedef void MyFunction(bool, int*); + char chars[] = { 97, 98, 99 }; + Action<MyFunction> a = SetArrayArgument<1>(chars, chars + 3); + + int codes[4] = { 111, 222, 333, 444 }; + int* pcodes = codes; + a.Perform(make_tuple(true, pcodes)); + EXPECT_EQ(97, codes[0]); + EXPECT_EQ(98, codes[1]); + EXPECT_EQ(99, codes[2]); + EXPECT_EQ(444, codes[3]); } // Test SetArrayArgument<N>(first, last) with iterator as argument. |