diff options
author | Tom Hughes <tomhughes@google.com> | 2023-03-03 23:54:32 (GMT) |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-03-06 15:14:21 (GMT) |
commit | 23142843f7c875907a6ed7985174a6e346e82c3d (patch) | |
tree | 27fada6ccf3be641ec3ec564887750cf6df98d70 /googlemock/test | |
parent | cead3d57c93ff8c4e5c1bbae57a5c0b0b0f6e168 (diff) | |
download | googletest-23142843f7c875907a6ed7985174a6e346e82c3d.zip googletest-23142843f7c875907a6ed7985174a6e346e82c3d.tar.gz googletest-23142843f7c875907a6ed7985174a6e346e82c3d.tar.bz2 |
Use "#ifdef GTEST_OS_..." instead of "#if GTEST_OS_..."
This is compatible with compiling with "-Wundef" (#3267).
PiperOrigin-RevId: 513943378
Change-Id: I47cf5fabbb77be061c4483a0adc54511af6b191c
Diffstat (limited to 'googlemock/test')
-rw-r--r-- | googlemock/test/gmock-actions_test.cc | 2 | ||||
-rw-r--r-- | googlemock/test/gmock-function-mocker_test.cc | 12 | ||||
-rw-r--r-- | googlemock/test/gmock-internal-utils_test.cc | 4 | ||||
-rw-r--r-- | googlemock/test/gmock_link_test.h | 6 |
4 files changed, 12 insertions, 12 deletions
diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc index f2d3042..7734830 100644 --- a/googlemock/test/gmock-actions_test.cc +++ b/googlemock/test/gmock-actions_test.cc @@ -1592,7 +1592,7 @@ TEST(WithArgsTest, RefQualifiedInnerAction) { EXPECT_EQ(19, mock.AsStdFunction()(0, 17)); } -#if !GTEST_OS_WINDOWS_MOBILE +#ifndef GTEST_OS_WINDOWS_MOBILE class SetErrnoAndReturnTest : public testing::Test { protected: diff --git a/googlemock/test/gmock-function-mocker_test.cc b/googlemock/test/gmock-function-mocker_test.cc index e211aff..4db498d 100644 --- a/googlemock/test/gmock-function-mocker_test.cc +++ b/googlemock/test/gmock-function-mocker_test.cc @@ -35,7 +35,7 @@ // Silence C4503 (decorated name length exceeded) for MSVC. GTEST_DISABLE_MSC_WARNINGS_PUSH_(4503) -#if GTEST_OS_WINDOWS +#ifdef 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 // objbase.h for definition of STDMETHOD. @@ -120,7 +120,7 @@ class FooInterface { virtual int RefQualifiedOverloaded() & = 0; virtual int RefQualifiedOverloaded() && = 0; -#if GTEST_OS_WINDOWS +#ifdef GTEST_OS_WINDOWS STDMETHOD_(int, CTNullary)() = 0; STDMETHOD_(bool, CTUnary)(int x) = 0; STDMETHOD_(int, CTDecimal) @@ -178,7 +178,7 @@ class MockFoo : public FooInterface { MOCK_METHOD(int (*)(bool), ReturnsFunctionPointer1, (int), ()); MOCK_METHOD(fn_ptr, ReturnsFunctionPointer2, (int), ()); -#if GTEST_OS_WINDOWS +#ifdef GTEST_OS_WINDOWS MOCK_METHOD(int, CTNullary, (), (Calltype(STDMETHODCALLTYPE))); MOCK_METHOD(bool, CTUnary, (int), (Calltype(STDMETHODCALLTYPE))); MOCK_METHOD(int, CTDecimal, @@ -248,7 +248,7 @@ class LegacyMockFoo : public FooInterface { MOCK_METHOD1(ReturnsFunctionPointer1, int (*(int))(bool)); MOCK_METHOD1(ReturnsFunctionPointer2, fn_ptr(int)); -#if GTEST_OS_WINDOWS +#ifdef GTEST_OS_WINDOWS MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, CTNullary, int()); MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, CTUnary, bool(int)); // NOLINT MOCK_METHOD10_WITH_CALLTYPE(STDMETHODCALLTYPE, CTDecimal, @@ -404,7 +404,7 @@ TYPED_TEST(FunctionMockerTest, MocksTypeWithTemplatedCopyCtor) { EXPECT_TRUE(this->foo_->TypeWithTemplatedCopyCtor(TemplatedCopyable<int>())); } -#if GTEST_OS_WINDOWS +#ifdef GTEST_OS_WINDOWS // Tests mocking a nullary function with calltype. TYPED_TEST(FunctionMockerTest, MocksNullaryFunctionWithCallType) { EXPECT_CALL(this->mock_foo_, CTNullary()) @@ -620,7 +620,7 @@ TYPED_TEST(TemplateMockTest, MethodWithCommaInReturnTypeWorks) { EXPECT_EQ(a_map, mock.ReturnTypeWithComma(1)); } -#if GTEST_OS_WINDOWS +#ifdef GTEST_OS_WINDOWS // Tests mocking template interfaces with calltype. template <typename T> diff --git a/googlemock/test/gmock-internal-utils_test.cc b/googlemock/test/gmock-internal-utils_test.cc index 932bece..360d02a 100644 --- a/googlemock/test/gmock-internal-utils_test.cc +++ b/googlemock/test/gmock-internal-utils_test.cc @@ -56,7 +56,7 @@ #include "src/gtest-internal-inl.h" #undef GTEST_IMPLEMENTATION_ -#if GTEST_OS_CYGWIN +#ifdef GTEST_OS_CYGWIN #include <sys/types.h> // For ssize_t. NOLINT #endif @@ -167,7 +167,7 @@ TEST(KindOfTest, Integer) { EXPECT_EQ(kInteger, GMOCK_KIND_OF_(unsigned long long)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(wchar_t)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(size_t)); // NOLINT -#if GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN +#if defined(GTEST_OS_LINUX) || defined(GTEST_OS_MAC) || defined(GTEST_OS_CYGWIN) // ssize_t is not defined on Windows and possibly some other OSes. EXPECT_EQ(kInteger, GMOCK_KIND_OF_(ssize_t)); // NOLINT #endif diff --git a/googlemock/test/gmock_link_test.h b/googlemock/test/gmock_link_test.h index 95a8cb8..8d2abb1 100644 --- a/googlemock/test/gmock_link_test.h +++ b/googlemock/test/gmock_link_test.h @@ -116,7 +116,7 @@ #include "gmock/gmock.h" -#if !GTEST_OS_WINDOWS_MOBILE +#ifndef GTEST_OS_WINDOWS_MOBILE #include <errno.h> #endif @@ -181,7 +181,7 @@ using testing::WithArg; using testing::WithArgs; using testing::WithoutArgs; -#if !GTEST_OS_WINDOWS_MOBILE +#ifndef GTEST_OS_WINDOWS_MOBILE using testing::SetErrnoAndReturn; #endif @@ -306,7 +306,7 @@ TEST(LinkTest, TestSetArrayArgument) { mock.VoidFromString(&ch); } -#if !GTEST_OS_WINDOWS_MOBILE +#ifndef GTEST_OS_WINDOWS_MOBILE // Tests the linkage of the SetErrnoAndReturn action. TEST(LinkTest, TestSetErrnoAndReturn) { |