Cleans up macro definitions.
This commit is contained in:
parent
1bee7b2f1d
commit
652540a278
|
@ -678,12 +678,12 @@ class SetArrayArgumentAction {
|
|||
|
||||
// Microsoft compiler deprecates ::std::copy, so we want to suppress warning
|
||||
// 4996 (Function call with parameters that may be unsafe) there.
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
#pragma warning(push) // Saves the current warning state.
|
||||
#pragma warning(disable:4996) // Temporarily disables warning 4996.
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
::std::copy(first_, last_, ::std::tr1::get<N>(args));
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
#pragma warning(pop) // Restores the warning state.
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
}
|
||||
|
|
|
@ -1141,13 +1141,13 @@ class TrulyMatcher {
|
|||
// interested in the address of the argument.
|
||||
template <typename T>
|
||||
bool Matches(T& x) const {
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
// MSVC warns about converting a value into bool (warning 4800).
|
||||
#pragma warning(push) // Saves the current warning state.
|
||||
#pragma warning(disable:4800) // Temporarily disables warning 4800.
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
return predicate_(x);
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
#pragma warning(pop) // Restores the warning state.
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
#include <tuple>
|
||||
#endif // __GNUC__
|
||||
|
||||
#ifdef GTEST_OS_LINUX
|
||||
#if GTEST_OS_LINUX
|
||||
|
||||
// On some platforms, <regex.h> needs someone to define size_t, and
|
||||
// won't compile otherwise. We can #include it here as we already
|
||||
|
@ -85,7 +85,7 @@ namespace internal {
|
|||
|
||||
// For Windows, check the compiler version. At least VS 2005 SP1 is
|
||||
// required to compile Google Mock.
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
|
||||
#if _MSC_VER < 1400
|
||||
#error "At least Visual Studio 2005 SP1 is required to compile Google Mock."
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace {
|
|||
|
||||
using ::std::ostream;
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
#define snprintf _snprintf_s
|
||||
#endif
|
||||
|
||||
|
|
|
@ -95,10 +95,10 @@ TEST(BuiltInDefaultValueTest, IsZeroForNumericTypes) {
|
|||
EXPECT_EQ(0, BuiltInDefaultValue<unsigned char>::Get());
|
||||
EXPECT_EQ(0, BuiltInDefaultValue<signed char>::Get());
|
||||
EXPECT_EQ(0, BuiltInDefaultValue<char>::Get());
|
||||
#ifndef GTEST_OS_WINDOWS
|
||||
#if !GTEST_OS_WINDOWS
|
||||
EXPECT_EQ(0, BuiltInDefaultValue<unsigned wchar_t>::Get());
|
||||
EXPECT_EQ(0, BuiltInDefaultValue<signed wchar_t>::Get());
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
#endif // !GTEST_OS_WINDOWS
|
||||
EXPECT_EQ(0, BuiltInDefaultValue<wchar_t>::Get());
|
||||
EXPECT_EQ(0, BuiltInDefaultValue<unsigned short>::Get()); // NOLINT
|
||||
EXPECT_EQ(0, BuiltInDefaultValue<signed short>::Get()); // NOLINT
|
||||
|
@ -121,10 +121,10 @@ TEST(BuiltInDefaultValueTest, ExistsForNumericTypes) {
|
|||
EXPECT_TRUE(BuiltInDefaultValue<unsigned char>::Exists());
|
||||
EXPECT_TRUE(BuiltInDefaultValue<signed char>::Exists());
|
||||
EXPECT_TRUE(BuiltInDefaultValue<char>::Exists());
|
||||
#ifndef GTEST_OS_WINDOWS
|
||||
#if !GTEST_OS_WINDOWS
|
||||
EXPECT_TRUE(BuiltInDefaultValue<unsigned wchar_t>::Exists());
|
||||
EXPECT_TRUE(BuiltInDefaultValue<signed wchar_t>::Exists());
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
#endif // !GTEST_OS_WINDOWS
|
||||
EXPECT_TRUE(BuiltInDefaultValue<wchar_t>::Exists());
|
||||
EXPECT_TRUE(BuiltInDefaultValue<unsigned short>::Exists()); // NOLINT
|
||||
EXPECT_TRUE(BuiltInDefaultValue<signed short>::Exists()); // NOLINT
|
||||
|
@ -196,7 +196,7 @@ TEST(BuiltInDefaultValueTest, UserTypeHasNoDefault) {
|
|||
EXPECT_FALSE(BuiltInDefaultValue<UserType>::Exists());
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// Tests that BuiltInDefaultValue<T&>::Get() aborts the program.
|
||||
TEST(BuiltInDefaultValueDeathTest, IsUndefinedForReferences) {
|
||||
|
@ -257,7 +257,7 @@ TEST(DefaultValueDeathTest, GetReturnsBuiltInDefaultValueWhenUnset) {
|
|||
|
||||
EXPECT_EQ(0, DefaultValue<int>::Get());
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
EXPECT_DEATH({ // NOLINT
|
||||
DefaultValue<UserType>::Get();
|
||||
}, "");
|
||||
|
@ -313,7 +313,7 @@ TEST(DefaultValueOfReferenceDeathTest, GetReturnsBuiltInDefaultValueWhenUnset) {
|
|||
EXPECT_FALSE(DefaultValue<int&>::IsSet());
|
||||
EXPECT_FALSE(DefaultValue<UserType&>::IsSet());
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
EXPECT_DEATH({ // NOLINT
|
||||
DefaultValue<int&>::Get();
|
||||
}, "");
|
||||
|
@ -556,7 +556,7 @@ TEST(DoDefaultTest, ReturnsBuiltInDefaultValueByDefault) {
|
|||
EXPECT_EQ(0, mock.IntFunc(true));
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// Tests that DoDefault() aborts the process when there is no built-in
|
||||
// default value for the return type.
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#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
|
||||
// objbase.h for definition of STDMETHOD.
|
||||
|
@ -50,9 +50,9 @@
|
|||
// There is a bug in MSVC (fixed in VS 2008) that prevents creating a
|
||||
// mock for a function with const arguments, so we don't test such
|
||||
// cases for MSVC versions older than 2008.
|
||||
#if !defined(GTEST_OS_WINDOWS) || (_MSC_VER >= 1500)
|
||||
#if !GTEST_OS_WINDOWS || (_MSC_VER >= 1500)
|
||||
#define GMOCK_ALLOWS_CONST_PARAM_FUNCTIONS
|
||||
#endif // !defined(GTEST_OS_WINDOWS) || (_MSC_VER >= 1500)
|
||||
#endif // !GTEST_OS_WINDOWS || (_MSC_VER >= 1500)
|
||||
|
||||
namespace testing {
|
||||
namespace gmock_generated_function_mockers_test {
|
||||
|
@ -102,7 +102,7 @@ class FooInterface {
|
|||
virtual int TypeWithHole(int (*func)()) = 0;
|
||||
virtual int TypeWithComma(const std::map<int, string>& a_map) = 0;
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
STDMETHOD_(int, CTNullary)() = 0;
|
||||
STDMETHOD_(bool, CTUnary)(int x) = 0;
|
||||
STDMETHOD_(int, CTDecimal)(bool b, char c, short d, int e, long f, // NOLINT
|
||||
|
@ -140,7 +140,7 @@ class MockFoo : public FooInterface {
|
|||
|
||||
MOCK_METHOD1(TypeWithHole, int(int (*)())); // NOLINT
|
||||
MOCK_METHOD1(TypeWithComma, int(const std::map<int, string>&)); // NOLINT
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, CTNullary, int());
|
||||
MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, CTUnary, bool(int));
|
||||
MOCK_METHOD10_WITH_CALLTYPE(STDMETHODCALLTYPE, CTDecimal, int(bool b, char c,
|
||||
|
@ -261,7 +261,7 @@ TEST_F(FunctionMockerTest, MocksFunctionsOverloadedOnConstnessOfThis) {
|
|||
EXPECT_EQ('a', Const(*foo_).OverloadedOnConstness());
|
||||
}
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
// Tests mocking a nullary function with calltype.
|
||||
TEST_F(FunctionMockerTest, MocksNullaryFunctionWithCallType) {
|
||||
EXPECT_CALL(mock_foo_, CTNullary())
|
||||
|
@ -373,7 +373,7 @@ TEST(TemplateMockTest, Works) {
|
|||
EXPECT_EQ(0, mock.GetSize());
|
||||
}
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
// Tests mocking template interfaces with calltype.
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -320,7 +320,7 @@ TEST(AssertTest, SucceedsOnTrue) {
|
|||
Assert(true, __FILE__, __LINE__); // This should succeed too.
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// Tests that Assert(false, ...) generates a fatal failure.
|
||||
TEST(AssertTest, FailsFatallyOnFalse) {
|
||||
|
|
|
@ -2462,7 +2462,7 @@ TEST(ResultOfTest, WorksForCompatibleMatcherTypes) {
|
|||
EXPECT_FALSE(matcher.Matches(42));
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
// Tests that the program aborts when ResultOf is passed
|
||||
// a NULL function pointer.
|
||||
TEST(ResultOfDeathTest, DiesOnNullFunctionPointers) {
|
||||
|
|
|
@ -65,7 +65,7 @@ TEST(GmockCheckSyntaxTest, WorksWithSwitch) {
|
|||
GMOCK_CHECK_(true) << "Check failed in switch case";
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
TEST(GmockCheckDeathTest, DiesWithCorrectOutputOnFailure) {
|
||||
const bool a_false_condition = false;
|
||||
|
|
|
@ -53,11 +53,11 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
// hash_map and hash_set are available on Windows.
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#define GMOCK_HAS_HASH_MAP_ // Indicates that hash_map is available.
|
||||
#include <hash_map> // NOLINT
|
||||
#define GMOCK_HAS_HASH_SET_ // Indicates that hash_set is available.
|
||||
#include <hash_set> // NOLINT
|
||||
#if GTEST_OS_WINDOWS
|
||||
#define GMOCK_HAS_HASH_MAP_ 1 // Indicates that hash_map is available.
|
||||
#include <hash_map> // NOLINT
|
||||
#define GMOCK_HAS_HASH_SET_ 1 // Indicates that hash_set is available.
|
||||
#include <hash_set> // NOLINT
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
// Some user-defined types for testing the universal value printer.
|
||||
|
@ -160,7 +160,7 @@ using ::testing::internal::UniversalTersePrintTupleFieldsToStrings;
|
|||
using ::testing::internal::UniversalPrinter;
|
||||
using ::testing::internal::string;
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
// MSVC defines the following classes in the ::stdext namespace while
|
||||
// gcc defines them in the :: namespace. Note that they are not part
|
||||
// of the C++ standard.
|
||||
|
@ -279,10 +279,10 @@ TEST(PrintBuiltInTypeTest, Integer) {
|
|||
// Size types.
|
||||
TEST(PrintBuiltInTypeTest, Size_t) {
|
||||
EXPECT_EQ("1", Print(sizeof('a'))); // size_t.
|
||||
#ifndef GTEST_OS_WINDOWS
|
||||
#if !GTEST_OS_WINDOWS
|
||||
// Windows has no ssize_t type.
|
||||
EXPECT_EQ("-2", Print(static_cast<ssize_t>(-2))); // ssize_t.
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
#endif // !GTEST_OS_WINDOWS
|
||||
}
|
||||
|
||||
// Floating-points.
|
||||
|
@ -674,7 +674,7 @@ TEST(PrintStlContainerTest, NonEmptyDeque) {
|
|||
EXPECT_EQ("{ 1, 3 }", Print(non_empty));
|
||||
}
|
||||
|
||||
#ifdef GMOCK_HAS_HASH_MAP_
|
||||
#if GMOCK_HAS_HASH_MAP_
|
||||
|
||||
TEST(PrintStlContainerTest, OneElementHashMap) {
|
||||
hash_map<int, char> map1;
|
||||
|
@ -696,7 +696,7 @@ TEST(PrintStlContainerTest, HashMultiMap) {
|
|||
|
||||
#endif // GMOCK_HAS_HASH_MAP_
|
||||
|
||||
#ifdef GMOCK_HAS_HASH_SET_
|
||||
#if GMOCK_HAS_HASH_SET_
|
||||
|
||||
TEST(PrintStlContainerTest, HashSet) {
|
||||
hash_set<string> set1;
|
||||
|
|
|
@ -192,7 +192,7 @@ TEST(OnCallSyntaxTest, WithArgumentsCanAppearAtMostOnce) {
|
|||
}, ".WithArguments() cannot appear more than once in an ON_CALL()");
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
TEST(OnCallSyntaxTest, WillByDefaultIsMandatory) {
|
||||
MockA a;
|
||||
|
@ -987,7 +987,7 @@ TEST(UnexpectedCallTest, UnsatisifiedPrerequisites) {
|
|||
|
||||
#endif // GMOCK_HAS_REGEX
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
TEST(UndefinedReturnValueTest, ReturnValueIsMandatory) {
|
||||
MockA a;
|
||||
|
@ -1143,7 +1143,7 @@ TEST(SequenceTest, AnyOrderIsOkByDefault) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// Tests that the calls must be in strict order when a complete order
|
||||
// is specified.
|
||||
|
|
Loading…
Reference in New Issue
Block a user