Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
652540a2
Commit
652540a2
authored
Feb 23, 2009
by
zhanyong.wan
Browse files
Cleans up macro definitions.
parent
1bee7b2f
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
38 additions
and
38 deletions
+38
-38
include/gmock/gmock-actions.h
include/gmock/gmock-actions.h
+2
-2
include/gmock/gmock-matchers.h
include/gmock/gmock-matchers.h
+2
-2
include/gmock/internal/gmock-port.h
include/gmock/internal/gmock-port.h
+2
-2
src/gmock-printers.cc
src/gmock-printers.cc
+1
-1
test/gmock-actions_test.cc
test/gmock-actions_test.cc
+8
-8
test/gmock-generated-function-mockers_test.cc
test/gmock-generated-function-mockers_test.cc
+7
-7
test/gmock-internal-utils_test.cc
test/gmock-internal-utils_test.cc
+1
-1
test/gmock-matchers_test.cc
test/gmock-matchers_test.cc
+1
-1
test/gmock-port_test.cc
test/gmock-port_test.cc
+1
-1
test/gmock-printers_test.cc
test/gmock-printers_test.cc
+10
-10
test/gmock-spec-builders_test.cc
test/gmock-spec-builders_test.cc
+3
-3
No files found.
include/gmock/gmock-actions.h
View file @
652540a2
...
...
@@ -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.
#if
def
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
));
#if
def
GTEST_OS_WINDOWS
#if GTEST_OS_WINDOWS
#pragma warning(pop) // Restores the warning state.
#endif // GTEST_OS_WINDOWS
}
...
...
include/gmock/gmock-matchers.h
View file @
652540a2
...
...
@@ -1141,13 +1141,13 @@ class TrulyMatcher {
// interested in the address of the argument.
template
<
typename
T
>
bool
Matches
(
T
&
x
)
const
{
#if
def
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
);
#if
def
GTEST_OS_WINDOWS
#if GTEST_OS_WINDOWS
#pragma warning(pop) // Restores the warning state.
#endif // GTEST_OS_WINDOWS
}
...
...
include/gmock/internal/gmock-port.h
View file @
652540a2
...
...
@@ -58,7 +58,7 @@
#include <tuple>
#endif // __GNUC__
#if
def
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.
#if
def
GTEST_OS_WINDOWS
#if GTEST_OS_WINDOWS
#if _MSC_VER < 1400
#error "At least Visual Studio 2005 SP1 is required to compile Google Mock."
...
...
src/gmock-printers.cc
View file @
652540a2
...
...
@@ -55,7 +55,7 @@ namespace {
using
::
std
::
ostream
;
#if
def
GTEST_OS_WINDOWS
#if GTEST_OS_WINDOWS
#define snprintf _snprintf_s
#endif
...
...
test/gmock-actions_test.cc
View file @
652540a2
...
...
@@ -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
());
#if
ndef
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
());
#if
ndef
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
());
}
#if
def
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
());
#if
def
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
());
#if
def
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
));
}
#if
def
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.
...
...
test/gmock-generated-function-mockers_test.cc
View file @
652540a2
...
...
@@ -40,7 +40,7 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#if
def
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
;
#if
def
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
#if
def
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
());
}
#if
def
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
());
}
#if
def
GTEST_OS_WINDOWS
#if GTEST_OS_WINDOWS
// Tests mocking template interfaces with calltype.
template
<
typename
T
>
...
...
test/gmock-internal-utils_test.cc
View file @
652540a2
...
...
@@ -320,7 +320,7 @@ TEST(AssertTest, SucceedsOnTrue) {
Assert
(
true
,
__FILE__
,
__LINE__
);
// This should succeed too.
}
#if
def
GTEST_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
// Tests that Assert(false, ...) generates a fatal failure.
TEST
(
AssertTest
,
FailsFatallyOnFalse
)
{
...
...
test/gmock-matchers_test.cc
View file @
652540a2
...
...
@@ -2462,7 +2462,7 @@ TEST(ResultOfTest, WorksForCompatibleMatcherTypes) {
EXPECT_FALSE
(
matcher
.
Matches
(
42
));
}
#if
def
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
)
{
...
...
test/gmock-port_test.cc
View file @
652540a2
...
...
@@ -65,7 +65,7 @@ TEST(GmockCheckSyntaxTest, WorksWithSwitch) {
GMOCK_CHECK_
(
true
)
<<
"Check failed in switch case"
;
}
#if
def
GTEST_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
TEST
(
GmockCheckDeathTest
,
DiesWithCorrectOutputOnFailure
)
{
const
bool
a_false_condition
=
false
;
...
...
test/gmock-printers_test.cc
View file @
652540a2
...
...
@@ -53,10 +53,10 @@
#include <gtest/gtest.h>
// hash_map and hash_set are available on Windows.
#if
def
GTEST_OS_WINDOWS
#define GMOCK_HAS_HASH_MAP_ // Indicates that hash_map is available.
#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_ // Indicates that hash_set is available.
#define GMOCK_HAS_HASH_SET_
1
// Indicates that hash_set is available.
#include <hash_set> // NOLINT
#endif // GTEST_OS_WINDOWS
...
...
@@ -160,7 +160,7 @@ using ::testing::internal::UniversalTersePrintTupleFieldsToStrings;
using
::
testing
::
internal
::
UniversalPrinter
;
using
::
testing
::
internal
::
string
;
#if
def
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.
#if
ndef
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
));
}
#if
def
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_
#if
def
GMOCK_HAS_HASH_SET_
#if GMOCK_HAS_HASH_SET_
TEST
(
PrintStlContainerTest
,
HashSet
)
{
hash_set
<
string
>
set1
;
...
...
test/gmock-spec-builders_test.cc
View file @
652540a2
...
...
@@ -192,7 +192,7 @@ TEST(OnCallSyntaxTest, WithArgumentsCanAppearAtMostOnce) {
},
".WithArguments() cannot appear more than once in an ON_CALL()"
);
}
#if
def
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
#if
def
GTEST_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
TEST
(
UndefinedReturnValueTest
,
ReturnValueIsMandatory
)
{
MockA
a
;
...
...
@@ -1143,7 +1143,7 @@ TEST(SequenceTest, AnyOrderIsOkByDefault) {
}
}
#if
def
GTEST_HAS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
// Tests that the calls must be in strict order when a complete order
// is specified.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment