diff options
Diffstat (limited to 'googlemock/test')
-rw-r--r-- | googlemock/test/gmock-actions_test.cc | 27 | ||||
-rw-r--r-- | googlemock/test/gmock-function-mocker_test.cc | 20 | ||||
-rw-r--r-- | googlemock/test/gmock-matchers-arithmetic_test.cc | 16 | ||||
-rw-r--r-- | googlemock/test/gmock-matchers-comparisons_test.cc | 17 | ||||
-rw-r--r-- | googlemock/test/gmock-matchers-containers_test.cc | 12 | ||||
-rw-r--r-- | googlemock/test/gmock-matchers-misc_test.cc | 12 | ||||
-rw-r--r-- | googlemock/test/gmock-more-actions_test.cc | 16 | ||||
-rw-r--r-- | googlemock/test/gmock-spec-builders_test.cc | 9 | ||||
-rw-r--r-- | googlemock/test/gmock_link_test.h | 9 | ||||
-rw-r--r-- | googlemock/test/gmock_output_test_.cc | 9 |
10 files changed, 52 insertions, 95 deletions
diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc index 295470e..f2d3042 100644 --- a/googlemock/test/gmock-actions_test.cc +++ b/googlemock/test/gmock-actions_test.cc @@ -31,19 +31,6 @@ // // This file tests the built-in actions. -// Silence C4100 (unreferenced formal parameter) and C4503 (decorated name -// length exceeded) for MSVC. -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4100) -#pragma warning(disable : 4503) -#if _MSC_VER == 1900 -// and silence C4800 (C4800: 'int *const ': forcing value -// to bool 'true' or 'false') for MSVC 15 -#pragma warning(disable : 4800) -#endif -#endif - #include "gmock/gmock-actions.h" #include <algorithm> @@ -59,6 +46,15 @@ #include "gtest/gtest-spi.h" #include "gtest/gtest.h" +// Silence C4100 (unreferenced formal parameter) and C4503 (decorated name +// length exceeded) for MSVC. +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4100 4503) +#if defined(_MSC_VER) && (_MSC_VER == 1900) +// and silence C4800 (C4800: 'int *const ': forcing value +// to bool 'true' or 'false') for MSVC 15 +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800) +#endif + namespace testing { namespace { @@ -2165,3 +2161,8 @@ TEST(ActionMacro, LargeArity) { } // namespace } // namespace testing + +#if defined(_MSC_VER) && (_MSC_VER == 1900) +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4800 +#endif +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4100 4503 diff --git a/googlemock/test/gmock-function-mocker_test.cc b/googlemock/test/gmock-function-mocker_test.cc index 1d15a29..e211aff 100644 --- a/googlemock/test/gmock-function-mocker_test.cc +++ b/googlemock/test/gmock-function-mocker_test.cc @@ -27,17 +27,14 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Silence C4503 (decorated name length exceeded) for MSVC. -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4503) -#endif - // Google Mock - a framework for writing C++ mock classes. // // This file tests the function mocker classes. #include "gmock/gmock-function-mocker.h" +// Silence C4503 (decorated name length exceeded) for MSVC. +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4503) + #if GTEST_OS_WINDOWS // MSDN says the header file to be included for STDMETHOD is BaseTyps.h but // we are getting compiler errors if we use basetyps.h, hence including @@ -137,10 +134,7 @@ class FooInterface { // 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 +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4373) class MockFoo : public FooInterface { public: MockFoo() {} @@ -285,9 +279,7 @@ class LegacyMockFoo : public FooInterface { LegacyMockFoo& operator=(const LegacyMockFoo&) = delete; }; -#ifdef _MSC_VER -#pragma warning(pop) -#endif +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4373 template <class T> class FunctionMockerTest : public testing::Test { @@ -1002,3 +994,5 @@ TEST(MockMethodMockFunctionTest, NoexceptSpecifierPreserved) { } // namespace gmock_function_mocker_test } // namespace testing + +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4503 diff --git a/googlemock/test/gmock-matchers-arithmetic_test.cc b/googlemock/test/gmock-matchers-arithmetic_test.cc index 36c2bf0..fd81a9e 100644 --- a/googlemock/test/gmock-matchers-arithmetic_test.cc +++ b/googlemock/test/gmock-matchers-arithmetic_test.cc @@ -31,18 +31,14 @@ // // This file tests some commonly used argument matchers. -// Silence warning C4244: 'initializing': conversion from 'int' to 'short', -// possible loss of data and C4100, unreferenced local parameter -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4244) -#pragma warning(disable : 4100) -#endif - #include "test/gmock-matchers_test.h" #include <limits> +// Silence warning C4244: 'initializing': conversion from 'int' to 'short', +// possible loss of data and C4100, unreferenced local parameter +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4244 4100) + namespace testing { namespace gmock_matchers_test { namespace { @@ -1514,6 +1510,4 @@ TEST(AnyOfTest, WorksOnMoveOnlyType) { } // namespace gmock_matchers_test } // namespace testing -#ifdef _MSC_VER -#pragma warning(pop) -#endif +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4244 4100 diff --git a/googlemock/test/gmock-matchers-comparisons_test.cc b/googlemock/test/gmock-matchers-comparisons_test.cc index 83242d6..3db9746 100644 --- a/googlemock/test/gmock-matchers-comparisons_test.cc +++ b/googlemock/test/gmock-matchers-comparisons_test.cc @@ -31,18 +31,15 @@ // // This file tests some commonly used argument matchers. -// Silence warning C4244: 'initializing': conversion from 'int' to 'short', -// possible loss of data and C4100, unreferenced local parameter -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4244) -#pragma warning(disable : 4100) -#endif - #include <vector> #include "test/gmock-matchers_test.h" +// Silence warning C4244: 'initializing': conversion from 'int' to 'short', +// possible loss of data and C4100, unreferenced local parameter +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4244 4100) + + namespace testing { namespace gmock_matchers_test { namespace { @@ -2354,6 +2351,4 @@ TEST(PolymorphicMatcherTest, CanAccessImpl) { } // namespace gmock_matchers_test } // namespace testing -#ifdef _MSC_VER -#pragma warning(pop) -#endif +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4244 4100 diff --git a/googlemock/test/gmock-matchers-containers_test.cc b/googlemock/test/gmock-matchers-containers_test.cc index 98787f2..b40a26a 100644 --- a/googlemock/test/gmock-matchers-containers_test.cc +++ b/googlemock/test/gmock-matchers-containers_test.cc @@ -31,13 +31,11 @@ // // This file tests some commonly used argument matchers. +#include "gtest/gtest.h" + // Silence warning C4244: 'initializing': conversion from 'int' to 'short', // possible loss of data and C4100, unreferenced local parameter -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4244) -#pragma warning(disable : 4100) -#endif +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4244 4100) #include "test/gmock-matchers_test.h" @@ -3124,6 +3122,4 @@ TEST(ContainsTest, WorksForTwoDimensionalNativeArray) { } // namespace gmock_matchers_test } // namespace testing -#ifdef _MSC_VER -#pragma warning(pop) -#endif +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4244 4100 diff --git a/googlemock/test/gmock-matchers-misc_test.cc b/googlemock/test/gmock-matchers-misc_test.cc index 1d1bfb9..c1e4f35 100644 --- a/googlemock/test/gmock-matchers-misc_test.cc +++ b/googlemock/test/gmock-matchers-misc_test.cc @@ -31,13 +31,11 @@ // // This file tests some commonly used argument matchers. +#include "gtest/gtest.h" + // Silence warning C4244: 'initializing': conversion from 'int' to 'short', // possible loss of data and C4100, unreferenced local parameter -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4244) -#pragma warning(disable : 4100) -#endif +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4244 4100) #include "test/gmock-matchers_test.h" @@ -1814,6 +1812,4 @@ TEST(ThrowsPredicateCompilesTest, MessageMatcherAcceptsNonMatcher) { } // namespace gmock_matchers_test } // namespace testing -#ifdef _MSC_VER -#pragma warning(pop) -#endif +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4244 4100 diff --git a/googlemock/test/gmock-more-actions_test.cc b/googlemock/test/gmock-more-actions_test.cc index b9b66bf..866e1ab 100644 --- a/googlemock/test/gmock-more-actions_test.cc +++ b/googlemock/test/gmock-more-actions_test.cc @@ -31,11 +31,6 @@ // // This file tests the built-in actions in gmock-actions.h. -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4577) -#endif - #include "gmock/gmock-more-actions.h" #include <functional> @@ -47,6 +42,8 @@ #include "gtest/gtest-spi.h" #include "gtest/gtest.h" +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4577) + namespace testing { namespace gmock_more_actions_test { @@ -982,11 +979,7 @@ TEST(DoAllTest, ImplicitlyConvertsActionArguments) { // is expanded and macro expansion cannot contain #pragma. Therefore // we suppress them here. // Also suppress C4503 decorated name length exceeded, name was truncated -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4100) -#pragma warning(disable : 4503) -#endif +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4100 4503) // Tests the ACTION*() macro family. // Tests that ACTION() can define an action that doesn't reference the @@ -1548,3 +1541,6 @@ TEST(ActionTemplateTest, CanBeOverloadedOnNumberOfValueParameters) { } // namespace gmock_more_actions_test } // namespace testing + +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4100 4503 +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4577 diff --git a/googlemock/test/gmock-spec-builders_test.cc b/googlemock/test/gmock-spec-builders_test.cc index 165944e..6c5e398 100644 --- a/googlemock/test/gmock-spec-builders_test.cc +++ b/googlemock/test/gmock-spec-builders_test.cc @@ -1779,16 +1779,11 @@ TEST(DeletingMockEarlyTest, Success2) { // Suppresses warning on unreferenced formal parameter in MSVC with // -W4. -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4100) -#endif +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4100) ACTION_P(Delete, ptr) { delete ptr; } -#ifdef _MSC_VER -#pragma warning(pop) -#endif +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4100 TEST(DeletingMockEarlyTest, CanDeleteSelfInActionReturningVoid) { MockA* const a = new MockA; diff --git a/googlemock/test/gmock_link_test.h b/googlemock/test/gmock_link_test.h index eaf18e9..95a8cb8 100644 --- a/googlemock/test/gmock_link_test.h +++ b/googlemock/test/gmock_link_test.h @@ -423,10 +423,7 @@ TEST(LinkTest, TestThrow) { // the macro definition, as the warnings are generated when the macro // is expanded and macro expansion cannot contain #pragma. Therefore // we suppress them here. -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4100) -#endif +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4100) // Tests the linkage of actions created using ACTION macro. namespace { @@ -459,9 +456,7 @@ ACTION_P2(ReturnEqualsEitherOf, first, second) { } } // namespace -#ifdef _MSC_VER -#pragma warning(pop) -#endif +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4100 TEST(LinkTest, TestActionP2Macro) { Mock mock; diff --git a/googlemock/test/gmock_output_test_.cc b/googlemock/test/gmock_output_test_.cc index a178691..af4eaa9 100644 --- a/googlemock/test/gmock_output_test_.cc +++ b/googlemock/test/gmock_output_test_.cc @@ -38,10 +38,7 @@ #include "gtest/gtest.h" // Silence C4100 (unreferenced formal parameter) -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4100) -#endif +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4100) using testing::_; using testing::AnyNumber; @@ -286,6 +283,4 @@ int main(int argc, char** argv) { return RUN_ALL_TESTS(); } -#ifdef _MSC_VER -#pragma warning(pop) -#endif +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4100 |