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
1cd979a8
Commit
1cd979a8
authored
Aug 01, 2018
by
Tanzinul Islam
Browse files
Merge branch 'master' into fix_death_test_child_mingw_wer_issue1116
parents
32800999
e5e2ef7c
Changes
115
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
110 additions
and
252 deletions
+110
-252
googlemock/include/gmock/gmock-matchers.h
googlemock/include/gmock/gmock-matchers.h
+28
-8
googlemock/include/gmock/gmock-more-actions.h
googlemock/include/gmock/gmock-more-actions.h
+2
-0
googlemock/include/gmock/gmock-more-matchers.h
googlemock/include/gmock/gmock-more-matchers.h
+2
-0
googlemock/include/gmock/gmock-spec-builders.h
googlemock/include/gmock/gmock-spec-builders.h
+20
-18
googlemock/include/gmock/gmock.h
googlemock/include/gmock/gmock.h
+2
-0
googlemock/include/gmock/internal/custom/gmock-generated-actions.h
...k/include/gmock/internal/custom/gmock-generated-actions.h
+2
-0
googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump
...lude/gmock/internal/custom/gmock-generated-actions.h.pump
+2
-0
googlemock/include/gmock/internal/custom/gmock-matchers.h
googlemock/include/gmock/internal/custom/gmock-matchers.h
+3
-1
googlemock/include/gmock/internal/custom/gmock-port.h
googlemock/include/gmock/internal/custom/gmock-port.h
+2
-0
googlemock/include/gmock/internal/gmock-generated-internal-utils.h
...k/include/gmock/internal/gmock-generated-internal-utils.h
+2
-0
googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump
...lude/gmock/internal/gmock-generated-internal-utils.h.pump
+2
-0
googlemock/include/gmock/internal/gmock-internal-utils.h
googlemock/include/gmock/internal/gmock-internal-utils.h
+3
-1
googlemock/include/gmock/internal/gmock-port.h
googlemock/include/gmock/internal/gmock-port.h
+2
-0
googlemock/scripts/generator/README
googlemock/scripts/generator/README
+4
-5
googlemock/scripts/upload.py
googlemock/scripts/upload.py
+4
-4
googlemock/src/gmock_main.cc
googlemock/src/gmock_main.cc
+1
-1
googlemock/test/gmock-actions_test.cc
googlemock/test/gmock-actions_test.cc
+0
-202
googlemock/test/gmock-matchers_test.cc
googlemock/test/gmock-matchers_test.cc
+26
-7
googlemock/test/gmock_ex_test.cc
googlemock/test/gmock_ex_test.cc
+3
-3
googlemock/test/gmock_leak_test.py
googlemock/test/gmock_leak_test.py
+0
-2
No files found.
googlemock/include/gmock/gmock-matchers.h
View file @
1cd979a8
...
@@ -35,6 +35,8 @@
...
@@ -35,6 +35,8 @@
// matchers can be defined by the user implementing the
// matchers can be defined by the user implementing the
// MatcherInterface<T> interface if necessary.
// MatcherInterface<T> interface if necessary.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_
...
@@ -2371,6 +2373,7 @@ class PointeeMatcher {
...
@@ -2371,6 +2373,7 @@ class PointeeMatcher {
GTEST_DISALLOW_ASSIGN_
(
PointeeMatcher
);
GTEST_DISALLOW_ASSIGN_
(
PointeeMatcher
);
};
};
#if GTEST_HAS_RTTI
// Implements the WhenDynamicCastTo<T>(m) matcher that matches a pointer or
// Implements the WhenDynamicCastTo<T>(m) matcher that matches a pointer or
// reference that matches inner_matcher when dynamic_cast<T> is applied.
// reference that matches inner_matcher when dynamic_cast<T> is applied.
// The result of dynamic_cast<To> is forwarded to the inner matcher.
// The result of dynamic_cast<To> is forwarded to the inner matcher.
...
@@ -2397,11 +2400,7 @@ class WhenDynamicCastToMatcherBase {
...
@@ -2397,11 +2400,7 @@ class WhenDynamicCastToMatcherBase {
const
Matcher
<
To
>
matcher_
;
const
Matcher
<
To
>
matcher_
;
static
std
::
string
GetToName
()
{
static
std
::
string
GetToName
()
{
#if GTEST_HAS_RTTI
return
GetTypeName
<
To
>
();
return
GetTypeName
<
To
>
();
#else // GTEST_HAS_RTTI
return
"the target type"
;
#endif // GTEST_HAS_RTTI
}
}
private:
private:
...
@@ -2447,6 +2446,7 @@ class WhenDynamicCastToMatcher<To&> : public WhenDynamicCastToMatcherBase<To&> {
...
@@ -2447,6 +2446,7 @@ class WhenDynamicCastToMatcher<To&> : public WhenDynamicCastToMatcherBase<To&> {
return
MatchPrintAndExplain
(
*
to
,
this
->
matcher_
,
listener
);
return
MatchPrintAndExplain
(
*
to
,
this
->
matcher_
,
listener
);
}
}
};
};
#endif // GTEST_HAS_RTTI
// Implements the Field() matcher for matching a field (i.e. member
// Implements the Field() matcher for matching a field (i.e. member
// variable) of an object.
// variable) of an object.
...
@@ -4441,6 +4441,7 @@ inline internal::PointeeMatcher<InnerMatcher> Pointee(
...
@@ -4441,6 +4441,7 @@ inline internal::PointeeMatcher<InnerMatcher> Pointee(
return
internal
::
PointeeMatcher
<
InnerMatcher
>
(
inner_matcher
);
return
internal
::
PointeeMatcher
<
InnerMatcher
>
(
inner_matcher
);
}
}
#if GTEST_HAS_RTTI
// Creates a matcher that matches a pointer or reference that matches
// Creates a matcher that matches a pointer or reference that matches
// inner_matcher when dynamic_cast<To> is applied.
// inner_matcher when dynamic_cast<To> is applied.
// The result of dynamic_cast<To> is forwarded to the inner matcher.
// The result of dynamic_cast<To> is forwarded to the inner matcher.
...
@@ -4453,6 +4454,7 @@ WhenDynamicCastTo(const Matcher<To>& inner_matcher) {
...
@@ -4453,6 +4454,7 @@ WhenDynamicCastTo(const Matcher<To>& inner_matcher) {
return
MakePolymorphicMatcher
(
return
MakePolymorphicMatcher
(
internal
::
WhenDynamicCastToMatcher
<
To
>
(
inner_matcher
));
internal
::
WhenDynamicCastToMatcher
<
To
>
(
inner_matcher
));
}
}
#endif // GTEST_HAS_RTTI
// Creates a matcher that matches an object whose given field matches
// Creates a matcher that matches an object whose given field matches
// 'matcher'. For example,
// 'matcher'. For example,
...
@@ -4529,6 +4531,20 @@ Property(PropertyType (Class::*property)() const &,
...
@@ -4529,6 +4531,20 @@ Property(PropertyType (Class::*property)() const &,
property
,
property
,
MatcherCast
<
GTEST_REFERENCE_TO_CONST_
(
PropertyType
)
>
(
matcher
)));
MatcherCast
<
GTEST_REFERENCE_TO_CONST_
(
PropertyType
)
>
(
matcher
)));
}
}
// Three-argument form for reference-qualified member functions.
template
<
typename
Class
,
typename
PropertyType
,
typename
PropertyMatcher
>
inline
PolymorphicMatcher
<
internal
::
PropertyMatcher
<
Class
,
PropertyType
,
PropertyType
(
Class
::*
)()
const
&>
>
Property
(
const
std
::
string
&
property_name
,
PropertyType
(
Class
::*
property
)()
const
&
,
const
PropertyMatcher
&
matcher
)
{
return
MakePolymorphicMatcher
(
internal
::
PropertyMatcher
<
Class
,
PropertyType
,
PropertyType
(
Class
::*
)()
const
&>
(
property_name
,
property
,
MatcherCast
<
GTEST_REFERENCE_TO_CONST_
(
PropertyType
)
>
(
matcher
)));
}
#endif
#endif
// Creates a matcher that matches an object iff the result of applying
// Creates a matcher that matches an object iff the result of applying
...
@@ -5165,13 +5181,17 @@ std::string DescribeMatcher(const M& matcher, bool negation = false) {
...
@@ -5165,13 +5181,17 @@ std::string DescribeMatcher(const M& matcher, bool negation = false) {
// Define variadic matcher versions. They are overloaded in
// Define variadic matcher versions. They are overloaded in
// gmock-generated-matchers.h for the cases supported by pre C++11 compilers.
// gmock-generated-matchers.h for the cases supported by pre C++11 compilers.
template
<
typename
...
Args
>
template
<
typename
...
Args
>
internal
::
AllOfMatcher
<
Args
...
>
AllOf
(
const
Args
&
...
matchers
)
{
internal
::
AllOfMatcher
<
typename
std
::
decay
<
const
Args
&>::
type
...
>
AllOf
(
return
internal
::
AllOfMatcher
<
Args
...
>
(
matchers
...);
const
Args
&
...
matchers
)
{
return
internal
::
AllOfMatcher
<
typename
std
::
decay
<
const
Args
&>::
type
...
>
(
matchers
...);
}
}
template
<
typename
...
Args
>
template
<
typename
...
Args
>
internal
::
AnyOfMatcher
<
Args
...
>
AnyOf
(
const
Args
&
...
matchers
)
{
internal
::
AnyOfMatcher
<
typename
std
::
decay
<
const
Args
&>::
type
...
>
AnyOf
(
return
internal
::
AnyOfMatcher
<
Args
...
>
(
matchers
...);
const
Args
&
...
matchers
)
{
return
internal
::
AnyOfMatcher
<
typename
std
::
decay
<
const
Args
&>::
type
...
>
(
matchers
...);
}
}
template
<
typename
...
Args
>
template
<
typename
...
Args
>
...
...
googlemock/include/gmock/gmock-more-actions.h
View file @
1cd979a8
...
@@ -33,6 +33,8 @@
...
@@ -33,6 +33,8 @@
//
//
// This file implements some actions that depend on gmock-generated-actions.h.
// This file implements some actions that depend on gmock-generated-actions.h.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
...
...
googlemock/include/gmock/gmock-more-matchers.h
View file @
1cd979a8
...
@@ -36,6 +36,8 @@
...
@@ -36,6 +36,8 @@
// Note that tests are implemented in gmock-matchers_test.cc rather than
// Note that tests are implemented in gmock-matchers_test.cc rather than
// gmock-more-matchers-test.cc.
// gmock-more-matchers-test.cc.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_GMOCK_MORE_MATCHERS_H_
#ifndef GMOCK_GMOCK_MORE_MATCHERS_H_
#define GMOCK_GMOCK_MORE_MATCHERS_H_
#define GMOCK_GMOCK_MORE_MATCHERS_H_
...
...
googlemock/include/gmock/gmock-spec-builders.h
View file @
1cd979a8
...
@@ -57,6 +57,8 @@
...
@@ -57,6 +57,8 @@
// where all clauses are optional, and .InSequence()/.After()/
// where all clauses are optional, and .InSequence()/.After()/
// .WillOnce() can appear any number of times.
// .WillOnce() can appear any number of times.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
...
@@ -1854,22 +1856,22 @@ inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT
...
@@ -1854,22 +1856,22 @@ inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT
// parameter. This technique may only be used for non-overloaded methods.
// parameter. This technique may only be used for non-overloaded methods.
//
//
// // These are the same:
// // These are the same:
// ON_CALL(mock, NoArgsMethod()).WillByDefault(
…
);
// ON_CALL(mock, NoArgsMethod()).WillByDefault(
...
);
// ON_CALL(mock, NoArgsMethod).WillByDefault(
…
);
// ON_CALL(mock, NoArgsMethod).WillByDefault(
...
);
//
//
// // As are these:
// // As are these:
// ON_CALL(mock, TwoArgsMethod(_, _)).WillByDefault(
…
);
// ON_CALL(mock, TwoArgsMethod(_, _)).WillByDefault(
...
);
// ON_CALL(mock, TwoArgsMethod).WillByDefault(
…
);
// ON_CALL(mock, TwoArgsMethod).WillByDefault(
...
);
//
//
// // Can also specify args if you want, of course:
// // Can also specify args if you want, of course:
// ON_CALL(mock, TwoArgsMethod(_, 45)).WillByDefault(
…
);
// ON_CALL(mock, TwoArgsMethod(_, 45)).WillByDefault(
...
);
//
//
// // Overloads work as long as you specify parameters:
// // Overloads work as long as you specify parameters:
// ON_CALL(mock, OverloadedMethod(_)).WillByDefault(
…
);
// ON_CALL(mock, OverloadedMethod(_)).WillByDefault(
...
);
// ON_CALL(mock, OverloadedMethod(_, _)).WillByDefault(
…
);
// ON_CALL(mock, OverloadedMethod(_, _)).WillByDefault(
...
);
//
//
// // Oops! Which overload did you want?
// // Oops! Which overload did you want?
// ON_CALL(mock, OverloadedMethod).WillByDefault(
…
);
// ON_CALL(mock, OverloadedMethod).WillByDefault(
...
);
// => ERROR: call to member function 'gmock_OverloadedMethod' is ambiguous
// => ERROR: call to member function 'gmock_OverloadedMethod' is ambiguous
//
//
// How this works: The mock class uses two overloads of the gmock_Method
// How this works: The mock class uses two overloads of the gmock_Method
...
@@ -1877,28 +1879,28 @@ inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT
...
@@ -1877,28 +1879,28 @@ inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT
// In the matcher list form, the macro expands to:
// In the matcher list form, the macro expands to:
//
//
// // This statement:
// // This statement:
// ON_CALL(mock, TwoArgsMethod(_, 45))
…
// ON_CALL(mock, TwoArgsMethod(_, 45))
...
//
//
// //
…
expands to:
// //
...
expands to:
// mock.gmock_TwoArgsMethod(_, 45)(WithoutMatchers(), nullptr)
…
// mock.gmock_TwoArgsMethod(_, 45)(WithoutMatchers(), nullptr)
...
// |-------------v---------------||------------v-------------|
// |-------------v---------------||------------v-------------|
// invokes first overload swallowed by operator()
// invokes first overload swallowed by operator()
//
//
// //
…
which is essentially:
// //
...
which is essentially:
// mock.gmock_TwoArgsMethod(_, 45)
…
// mock.gmock_TwoArgsMethod(_, 45)
...
//
//
// Whereas the form without a matcher list:
// Whereas the form without a matcher list:
//
//
// // This statement:
// // This statement:
// ON_CALL(mock, TwoArgsMethod)
…
// ON_CALL(mock, TwoArgsMethod)
...
//
//
// //
…
expands to:
// //
...
expands to:
// mock.gmock_TwoArgsMethod(WithoutMatchers(), nullptr)
…
// mock.gmock_TwoArgsMethod(WithoutMatchers(), nullptr)
...
// |-----------------------v--------------------------|
// |-----------------------v--------------------------|
// invokes second overload
// invokes second overload
//
//
// //
…
which is essentially:
// //
...
which is essentially:
// mock.gmock_TwoArgsMethod(_, _)
…
// mock.gmock_TwoArgsMethod(_, _)
...
//
//
// The WithoutMatchers() argument is used to disambiguate overloads and to
// The WithoutMatchers() argument is used to disambiguate overloads and to
// block the caller from accidentally invoking the second overload directly. The
// block the caller from accidentally invoking the second overload directly. The
...
...
googlemock/include/gmock/gmock.h
View file @
1cd979a8
...
@@ -33,6 +33,8 @@
...
@@ -33,6 +33,8 @@
//
//
// This is the main header file a user should include.
// This is the main header file a user should include.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_H_
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_H_
...
...
googlemock/include/gmock/internal/custom/gmock-generated-actions.h
View file @
1cd979a8
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
// pump.py gmock-generated-actions.h.pump
// pump.py gmock-generated-actions.h.pump
// DO NOT EDIT BY HAND!!!
// DO NOT EDIT BY HAND!!!
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
...
...
googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump
View file @
1cd979a8
...
@@ -4,6 +4,8 @@ $$ it to callback-actions.h.
...
@@ -4,6 +4,8 @@ $$ it to callback-actions.h.
$$
$$
$
var
max_callback_arity
=
5
$
var
max_callback_arity
=
5
$$}}
This
meta
comment
fixes
auto
-
indentation
in
editors
.
$$}}
This
meta
comment
fixes
auto
-
indentation
in
editors
.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
...
...
googlemock/include/gmock/internal/custom/gmock-matchers.h
View file @
1cd979a8
...
@@ -32,7 +32,9 @@
...
@@ -32,7 +32,9 @@
// ============================================================
// ============================================================
//
//
// Adds google3 callback support to CallableTraits.
// Adds google3 callback support to CallableTraits.
//
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
googlemock/include/gmock/internal/custom/gmock-port.h
View file @
1cd979a8
...
@@ -40,6 +40,8 @@
...
@@ -40,6 +40,8 @@
//
//
// ** Custom implementation starts here **
// ** Custom implementation starts here **
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
...
...
googlemock/include/gmock/internal/gmock-generated-internal-utils.h
View file @
1cd979a8
...
@@ -38,6 +38,8 @@
...
@@ -38,6 +38,8 @@
// This file contains template meta-programming utility classes needed
// This file contains template meta-programming utility classes needed
// for implementing Google Mock.
// for implementing Google Mock.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
...
...
googlemock/include/gmock/internal/gmock-generated-internal-utils.h.pump
View file @
1cd979a8
...
@@ -39,6 +39,8 @@ $var n = 10 $$ The maximum arity we support.
...
@@ -39,6 +39,8 @@ $var n = 10 $$ The maximum arity we support.
// This file contains template meta-programming utility classes needed
// This file contains template meta-programming utility classes needed
// for implementing Google Mock.
// for implementing Google Mock.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
...
...
googlemock/include/gmock/internal/gmock-internal-utils.h
View file @
1cd979a8
...
@@ -35,6 +35,8 @@
...
@@ -35,6 +35,8 @@
// Mock. They are subject to change without notice, so please DO NOT
// Mock. They are subject to change without notice, so please DO NOT
// USE THEM IN USER CODE.
// USE THEM IN USER CODE.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_INTERNAL_UTILS_H_
...
@@ -348,7 +350,7 @@ GTEST_API_ void Log(LogSeverity severity, const std::string& message,
...
@@ -348,7 +350,7 @@ GTEST_API_ void Log(LogSeverity severity, const std::string& message,
// correct overload. This must not be instantiable, to prevent client code from
// correct overload. This must not be instantiable, to prevent client code from
// accidentally resolving to the overload; for example:
// accidentally resolving to the overload; for example:
//
//
// ON_CALL(mock, Method({}, nullptr))
…
// ON_CALL(mock, Method({}, nullptr))
...
//
//
class
WithoutMatchers
{
class
WithoutMatchers
{
private:
private:
...
...
googlemock/include/gmock/internal/gmock-port.h
View file @
1cd979a8
...
@@ -36,6 +36,8 @@
...
@@ -36,6 +36,8 @@
// end with _ are part of Google Mock's public API and can be used by
// end with _ are part of Google Mock's public API and can be used by
// code outside Google Mock.
// code outside Google Mock.
// GOOGLETEST_CM0002 DO NOT DELETE
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
#ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
#define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
...
...
googlemock/scripts/generator/README
View file @
1cd979a8
The Google Mock class generator is an application that is part of cppclean.
The Google Mock class generator is an application that is part of cppclean.
For more information about cppclean, see the README.cppclean file or
For more information about cppclean, visit http://code.google.com/p/cppclean/
visit http://code.google.com/p/cppclean/
cppclean
requires Python 2.3.5 or later. If you don't have Python
installed
The mock generator
requires Python 2.3.5 or later. If you don't have Python
on your system, you will also need to install it. You can download
Python
installed
on your system, you will also need to install it. You can download
from: http://www.python.org/download/releases/
Python
from: http://www.python.org/download/releases/
To use the Google Mock class generator, you need to call it
To use the Google Mock class generator, you need to call it
on the command line passing the header file and class for which you want
on the command line passing the header file and class for which you want
...
...
googlemock/scripts/upload.py
View file @
1cd979a8
...
@@ -242,7 +242,7 @@ class AbstractRpcServer(object):
...
@@ -242,7 +242,7 @@ class AbstractRpcServer(object):
The authentication process works as follows:
The authentication process works as follows:
1) We get a username and password from the user
1) We get a username and password from the user
2) We use ClientLogin to obtain an AUTH token for the user
2) We use ClientLogin to obtain an AUTH token for the user
(see http://
co
de.google.com/
apis/account
s/AuthForInstalledApps
.html
).
(see http
s
://de
velopers
.google.com/
identity/protocol
s/AuthForInstalledApps).
3) We pass the auth token to /_ah/login on the server to obtain an
3) We pass the auth token to /_ah/login on the server to obtain an
authentication cookie. If login was successful, it tries to redirect
authentication cookie. If login was successful, it tries to redirect
us to the URL we provided.
us to the URL we provided.
...
@@ -506,7 +506,7 @@ def EncodeMultipartFormData(fields, files):
...
@@ -506,7 +506,7 @@ def EncodeMultipartFormData(fields, files):
(content_type, body) ready for httplib.HTTP instance.
(content_type, body) ready for httplib.HTTP instance.
Source:
Source:
http://
aspn.activestate.com/ASPN/Cookbook/Python/R
ecipe/146306
http
s
://
web.archive.org/web/20160116052001/code.activestate.com/r
ecipe
s
/146306
"""
"""
BOUNDARY
=
'-M-A-G-I-C---B-O-U-N-D-A-R-Y-'
BOUNDARY
=
'-M-A-G-I-C---B-O-U-N-D-A-R-Y-'
CRLF
=
'
\r\n
'
CRLF
=
'
\r\n
'
...
@@ -807,7 +807,7 @@ class SubversionVCS(VersionControlSystem):
...
@@ -807,7 +807,7 @@ class SubversionVCS(VersionControlSystem):
# svn cat translates keywords but svn diff doesn't. As a result of this
# svn cat translates keywords but svn diff doesn't. As a result of this
# behavior patching.PatchChunks() fails with a chunk mismatch error.
# behavior patching.PatchChunks() fails with a chunk mismatch error.
# This part was originally written by the Review Board development team
# This part was originally written by the Review Board development team
# who had the same problem (http://reviews.review
-
board.org/r/276/).
# who had the same problem (http
s
://reviews.reviewboard.org/r/276/).
# Mapping of keywords to known aliases
# Mapping of keywords to known aliases
svn_keywords
=
{
svn_keywords
=
{
# Standard keywords
# Standard keywords
...
@@ -860,7 +860,7 @@ class SubversionVCS(VersionControlSystem):
...
@@ -860,7 +860,7 @@ class SubversionVCS(VersionControlSystem):
status_lines
=
status
.
splitlines
()
status_lines
=
status
.
splitlines
()
# If file is in a cl, the output will begin with
# If file is in a cl, the output will begin with
# "\n--- Changelist 'cl_name':\n". See
# "\n--- Changelist 'cl_name':\n". See
# http://svn.collab.net/repos/svn/trunk/notes/changelist-design.txt
# http
s
://
web.archive.org/web/20090918234815/
svn.collab.net/repos/svn/trunk/notes/changelist-design.txt
if
(
len
(
status_lines
)
==
3
and
if
(
len
(
status_lines
)
==
3
and
not
status_lines
[
0
]
and
not
status_lines
[
0
]
and
status_lines
[
1
].
startswith
(
"--- Changelist"
)):
status_lines
[
1
].
startswith
(
"--- Changelist"
)):
...
...
googlemock/src/gmock_main.cc
View file @
1cd979a8
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
// causes a link error when _tmain is defined in a static library and UNICODE
// causes a link error when _tmain is defined in a static library and UNICODE
// is enabled. For this reason instead of _tmain, main function is used on
// is enabled. For this reason instead of _tmain, main function is used on
// Windows. See the following link to track the current status of this bug:
// Windows. See the following link to track the current status of this bug:
// http://connect.microsoft.com/VisualStudio/feedback/
ViewFeedback.aspx?FeedbackID=394464
// NOLINT
// http
s
://
web.archive.org/web/20170912203238/
connect.microsoft.com/VisualStudio/feedback/
details/394464/wmain-link-error-in-the-static-library
// NOLINT
#if GTEST_OS_WINDOWS_MOBILE
#if GTEST_OS_WINDOWS_MOBILE
# include <tchar.h> // NOLINT
# include <tchar.h> // NOLINT
...
...
googlemock/test/gmock-actions_test.cc
View file @
1cd979a8
...
@@ -88,10 +88,6 @@ using testing::tuple_element;
...
@@ -88,10 +88,6 @@ using testing::tuple_element;
using
testing
::
SetErrnoAndReturn
;
using
testing
::
SetErrnoAndReturn
;
#endif
#endif
#if GTEST_HAS_PROTOBUF_
using
testing
::
internal
::
TestMessage
;
#endif // GTEST_HAS_PROTOBUF_
// Tests that BuiltInDefaultValue<T*>::Get() returns NULL.
// Tests that BuiltInDefaultValue<T*>::Get() returns NULL.
TEST
(
BuiltInDefaultValueTest
,
IsNullForPointerTypes
)
{
TEST
(
BuiltInDefaultValueTest
,
IsNullForPointerTypes
)
{
EXPECT_TRUE
(
BuiltInDefaultValue
<
int
*>::
Get
()
==
NULL
);
EXPECT_TRUE
(
BuiltInDefaultValue
<
int
*>::
Get
()
==
NULL
);
...
@@ -895,105 +891,6 @@ TEST(SetArgPointeeTest, AcceptsWideCharPointer) {
...
@@ -895,105 +891,6 @@ TEST(SetArgPointeeTest, AcceptsWideCharPointer) {
# endif
# endif
}
}
#if GTEST_HAS_PROTOBUF_
// Tests that SetArgPointee<N>(proto_buffer) sets the v1 protobuf
// variable pointed to by the N-th (0-based) argument to proto_buffer.
TEST
(
SetArgPointeeTest
,
SetsTheNthPointeeOfProtoBufferType
)
{
TestMessage
*
const
msg
=
new
TestMessage
;
msg
->
set_member
(
"yes"
);
TestMessage
orig_msg
;
orig_msg
.
CopyFrom
(
*
msg
);
Action
<
void
(
bool
,
TestMessage
*
)
>
a
=
SetArgPointee
<
1
>
(
*
msg
);
// SetArgPointee<N>(proto_buffer) makes a copy of proto_buffer
// s.t. the action works even when the original proto_buffer has
// died. We ensure this behavior by deleting msg before using the
// action.
delete
msg
;
TestMessage
dest
;
EXPECT_FALSE
(
orig_msg
.
Equals
(
dest
));
a
.
Perform
(
make_tuple
(
true
,
&
dest
));
EXPECT_TRUE
(
orig_msg
.
Equals
(
dest
));
}
// Tests that SetArgPointee<N>(proto_buffer) sets the
// ::ProtocolMessage variable pointed to by the N-th (0-based)
// argument to proto_buffer.
TEST
(
SetArgPointeeTest
,
SetsTheNthPointeeOfProtoBufferBaseType
)
{
TestMessage
*
const
msg
=
new
TestMessage
;
msg
->
set_member
(
"yes"
);
TestMessage
orig_msg
;
orig_msg
.
CopyFrom
(
*
msg
);
Action
<
void
(
bool
,
::
ProtocolMessage
*
)
>
a
=
SetArgPointee
<
1
>
(
*
msg
);
// SetArgPointee<N>(proto_buffer) makes a copy of proto_buffer
// s.t. the action works even when the original proto_buffer has
// died. We ensure this behavior by deleting msg before using the
// action.
delete
msg
;
TestMessage
dest
;
::
ProtocolMessage
*
const
dest_base
=
&
dest
;
EXPECT_FALSE
(
orig_msg
.
Equals
(
dest
));
a
.
Perform
(
make_tuple
(
true
,
dest_base
));
EXPECT_TRUE
(
orig_msg
.
Equals
(
dest
));
}
// Tests that SetArgPointee<N>(proto2_buffer) sets the v2
// protobuf variable pointed to by the N-th (0-based) argument to
// proto2_buffer.
TEST
(
SetArgPointeeTest
,
SetsTheNthPointeeOfProto2BufferType
)
{
using
testing
::
internal
::
FooMessage
;
FooMessage
*
const
msg
=
new
FooMessage
;
msg
->
set_int_field
(
2
);
msg
->
set_string_field
(
"hi"
);
FooMessage
orig_msg
;
orig_msg
.
CopyFrom
(
*
msg
);
Action
<
void
(
bool
,
FooMessage
*
)
>
a
=
SetArgPointee
<
1
>
(
*
msg
);
// SetArgPointee<N>(proto2_buffer) makes a copy of
// proto2_buffer s.t. the action works even when the original
// proto2_buffer has died. We ensure this behavior by deleting msg
// before using the action.
delete
msg
;
FooMessage
dest
;
dest
.
set_int_field
(
0
);
a
.
Perform
(
make_tuple
(
true
,
&
dest
));
EXPECT_EQ
(
2
,
dest
.
int_field
());
EXPECT_EQ
(
"hi"
,
dest
.
string_field
());
}
// Tests that SetArgPointee<N>(proto2_buffer) sets the
// proto2::Message variable pointed to by the N-th (0-based) argument
// to proto2_buffer.
TEST
(
SetArgPointeeTest
,
SetsTheNthPointeeOfProto2BufferBaseType
)
{
using
testing
::
internal
::
FooMessage
;
FooMessage
*
const
msg
=
new
FooMessage
;
msg
->
set_int_field
(
2
);
msg
->
set_string_field
(
"hi"
);
FooMessage
orig_msg
;
orig_msg
.
CopyFrom
(
*
msg
);
Action
<
void
(
bool
,
::
proto2
::
Message
*
)
>
a
=
SetArgPointee
<
1
>
(
*
msg
);
// SetArgPointee<N>(proto2_buffer) makes a copy of
// proto2_buffer s.t. the action works even when the original
// proto2_buffer has died. We ensure this behavior by deleting msg
// before using the action.
delete
msg
;
FooMessage
dest
;
dest
.
set_int_field
(
0
);
::
proto2
::
Message
*
const
dest_base
=
&
dest
;
a
.
Perform
(
make_tuple
(
true
,
dest_base
));
EXPECT_EQ
(
2
,
dest
.
int_field
());
EXPECT_EQ
(
"hi"
,
dest
.
string_field
());
}
#endif // GTEST_HAS_PROTOBUF_
// Tests that SetArgumentPointee<N>(v) sets the variable pointed to by
// Tests that SetArgumentPointee<N>(v) sets the variable pointed to by
// the N-th (0-based) argument to v.
// the N-th (0-based) argument to v.
TEST
(
SetArgumentPointeeTest
,
SetsTheNthPointee
)
{
TEST
(
SetArgumentPointeeTest
,
SetsTheNthPointee
)
{
...
@@ -1014,105 +911,6 @@ TEST(SetArgumentPointeeTest, SetsTheNthPointee) {
...
@@ -1014,105 +911,6 @@ TEST(SetArgumentPointeeTest, SetsTheNthPointee) {
EXPECT_EQ
(
'a'
,
ch
);
EXPECT_EQ
(
'a'
,
ch
);
}
}
#if GTEST_HAS_PROTOBUF_
// Tests that SetArgumentPointee<N>(proto_buffer) sets the v1 protobuf
// variable pointed to by the N-th (0-based) argument to proto_buffer.
TEST
(
SetArgumentPointeeTest
,
SetsTheNthPointeeOfProtoBufferType
)
{
TestMessage
*
const
msg
=
new
TestMessage
;
msg
->
set_member
(
"yes"
);
TestMessage
orig_msg
;
orig_msg
.
CopyFrom
(
*
msg
);
Action
<
void
(
bool
,
TestMessage
*
)
>
a
=
SetArgumentPointee
<
1
>
(
*
msg
);
// SetArgumentPointee<N>(proto_buffer) makes a copy of proto_buffer
// s.t. the action works even when the original proto_buffer has
// died. We ensure this behavior by deleting msg before using the
// action.
delete
msg
;
TestMessage
dest
;
EXPECT_FALSE
(
orig_msg
.
Equals
(
dest
));
a
.
Perform
(
make_tuple
(
true
,
&
dest
));
EXPECT_TRUE
(
orig_msg
.
Equals
(
dest
));
}
// Tests that SetArgumentPointee<N>(proto_buffer) sets the
// ::ProtocolMessage variable pointed to by the N-th (0-based)
// argument to proto_buffer.
TEST
(
SetArgumentPointeeTest
,
SetsTheNthPointeeOfProtoBufferBaseType
)
{
TestMessage
*
const
msg
=
new
TestMessage
;
msg
->
set_member
(
"yes"
);
TestMessage
orig_msg
;
orig_msg
.
CopyFrom
(
*
msg
);
Action
<
void
(
bool
,
::
ProtocolMessage
*
)
>
a
=
SetArgumentPointee
<
1
>
(
*
msg
);
// SetArgumentPointee<N>(proto_buffer) makes a copy of proto_buffer
// s.t. the action works even when the original proto_buffer has
// died. We ensure this behavior by deleting msg before using the
// action.
delete
msg
;
TestMessage
dest
;
::
ProtocolMessage
*
const
dest_base
=
&
dest
;
EXPECT_FALSE
(
orig_msg
.
Equals
(
dest
));
a
.
Perform
(
make_tuple
(
true
,
dest_base
));
EXPECT_TRUE
(
orig_msg
.
Equals
(
dest
));
}
// Tests that SetArgumentPointee<N>(proto2_buffer) sets the v2
// protobuf variable pointed to by the N-th (0-based) argument to
// proto2_buffer.
TEST
(
SetArgumentPointeeTest
,
SetsTheNthPointeeOfProto2BufferType
)
{
using
testing
::
internal
::
FooMessage
;
FooMessage
*
const
msg
=
new
FooMessage
;
msg
->
set_int_field
(
2
);
msg
->
set_string_field
(
"hi"
);
FooMessage
orig_msg
;
orig_msg
.
CopyFrom
(
*
msg
);
Action
<
void
(
bool
,
FooMessage
*
)
>
a
=
SetArgumentPointee
<
1
>
(
*
msg
);
// SetArgumentPointee<N>(proto2_buffer) makes a copy of
// proto2_buffer s.t. the action works even when the original
// proto2_buffer has died. We ensure this behavior by deleting msg
// before using the action.
delete
msg
;
FooMessage
dest
;
dest
.
set_int_field
(
0
);
a
.
Perform
(
make_tuple
(
true
,
&
dest
));
EXPECT_EQ
(
2
,
dest
.
int_field
());
EXPECT_EQ
(
"hi"
,
dest
.
string_field
());
}
// Tests that SetArgumentPointee<N>(proto2_buffer) sets the
// proto2::Message variable pointed to by the N-th (0-based) argument
// to proto2_buffer.
TEST
(
SetArgumentPointeeTest
,
SetsTheNthPointeeOfProto2BufferBaseType
)
{
using
testing
::
internal
::
FooMessage
;
FooMessage
*
const
msg
=
new
FooMessage
;
msg
->
set_int_field
(
2
);
msg
->
set_string_field
(
"hi"
);
FooMessage
orig_msg
;
orig_msg
.
CopyFrom
(
*
msg
);
Action
<
void
(
bool
,
::
proto2
::
Message
*
)
>
a
=
SetArgumentPointee
<
1
>
(
*
msg
);
// SetArgumentPointee<N>(proto2_buffer) makes a copy of
// proto2_buffer s.t. the action works even when the original
// proto2_buffer has died. We ensure this behavior by deleting msg
// before using the action.
delete
msg
;
FooMessage
dest
;
dest
.
set_int_field
(
0
);
::
proto2
::
Message
*
const
dest_base
=
&
dest
;
a
.
Perform
(
make_tuple
(
true
,
dest_base
));
EXPECT_EQ
(
2
,
dest
.
int_field
());
EXPECT_EQ
(
"hi"
,
dest
.
string_field
());
}
#endif // GTEST_HAS_PROTOBUF_
// Sample functions and functors for testing Invoke() and etc.
// Sample functions and functors for testing Invoke() and etc.
int
Nullary
()
{
return
1
;
}
int
Nullary
()
{
return
1
;
}
...
...
googlemock/test/gmock-matchers_test.cc
View file @
1cd979a8
...
@@ -2680,7 +2680,7 @@ TEST(AllOfTest, ExplainsResult) {
...
@@ -2680,7 +2680,7 @@ TEST(AllOfTest, ExplainsResult) {
}
}
// Helper to allow easy testing of AnyOf matchers with num parameters.
// Helper to allow easy testing of AnyOf matchers with num parameters.
void
AnyOfMatches
(
int
num
,
const
Matcher
<
int
>&
m
)
{
static
void
AnyOfMatches
(
int
num
,
const
Matcher
<
int
>&
m
)
{
SCOPED_TRACE
(
Describe
(
m
));
SCOPED_TRACE
(
Describe
(
m
));
EXPECT_FALSE
(
m
.
Matches
(
0
));
EXPECT_FALSE
(
m
.
Matches
(
0
));
for
(
int
i
=
1
;
i
<=
num
;
++
i
)
{
for
(
int
i
=
1
;
i
<=
num
;
++
i
)
{
...
@@ -2689,6 +2689,18 @@ void AnyOfMatches(int num, const Matcher<int>& m) {
...
@@ -2689,6 +2689,18 @@ void AnyOfMatches(int num, const Matcher<int>& m) {
EXPECT_FALSE
(
m
.
Matches
(
num
+
1
));
EXPECT_FALSE
(
m
.
Matches
(
num
+
1
));
}
}
#if GTEST_LANG_CXX11
static
void
AnyOfStringMatches
(
int
num
,
const
Matcher
<
std
::
string
>&
m
)
{
SCOPED_TRACE
(
Describe
(
m
));
EXPECT_FALSE
(
m
.
Matches
(
std
::
to_string
(
0
)));
for
(
int
i
=
1
;
i
<=
num
;
++
i
)
{
EXPECT_TRUE
(
m
.
Matches
(
std
::
to_string
(
i
)));
}
EXPECT_FALSE
(
m
.
Matches
(
std
::
to_string
(
num
+
1
)));
}
#endif
// Tests that AnyOf(m1, ..., mn) matches any value that matches at
// Tests that AnyOf(m1, ..., mn) matches any value that matches at
// least one of the given matchers.
// least one of the given matchers.
TEST
(
AnyOfTest
,
MatchesWhenAnyMatches
)
{
TEST
(
AnyOfTest
,
MatchesWhenAnyMatches
)
{
...
@@ -2746,6 +2758,12 @@ TEST(AnyOfTest, VariadicMatchesWhenAnyMatches) {
...
@@ -2746,6 +2758,12 @@ TEST(AnyOfTest, VariadicMatchesWhenAnyMatches) {
21
,
22
,
23
,
24
,
25
,
26
,
27
,
28
,
29
,
30
,
21
,
22
,
23
,
24
,
25
,
26
,
27
,
28
,
29
,
30
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
38
,
39
,
40
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
38
,
39
,
40
,
41
,
42
,
43
,
44
,
45
,
46
,
47
,
48
,
49
,
50
));
41
,
42
,
43
,
44
,
45
,
46
,
47
,
48
,
49
,
50
));
AnyOfStringMatches
(
50
,
AnyOf
(
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"10"
,
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
"16"
,
"17"
,
"18"
,
"19"
,
"20"
,
"21"
,
"22"
,
"23"
,
"24"
,
"25"
,
"26"
,
"27"
,
"28"
,
"29"
,
"30"
,
"31"
,
"32"
,
"33"
,
"34"
,
"35"
,
"36"
,
"37"
,
"38"
,
"39"
,
"40"
,
"41"
,
"42"
,
"43"
,
"44"
,
"45"
,
"46"
,
"47"
,
"48"
,
"49"
,
"50"
));
}
}
// Tests the variadic version of the ElementsAreMatcher
// Tests the variadic version of the ElementsAreMatcher
...
@@ -3704,6 +3722,7 @@ MATCHER_P(FieldIIs, inner_matcher, "") {
...
@@ -3704,6 +3722,7 @@ MATCHER_P(FieldIIs, inner_matcher, "") {
return
ExplainMatchResult
(
inner_matcher
,
arg
.
i
,
result_listener
);
return
ExplainMatchResult
(
inner_matcher
,
arg
.
i
,
result_listener
);
}
}
#if GTEST_HAS_RTTI
TEST
(
WhenDynamicCastToTest
,
SameType
)
{
TEST
(
WhenDynamicCastToTest
,
SameType
)
{
Derived
derived
;
Derived
derived
;
derived
.
i
=
4
;
derived
.
i
=
4
;
...
@@ -3761,12 +3780,8 @@ TEST(WhenDynamicCastToTest, AmbiguousCast) {
...
@@ -3761,12 +3780,8 @@ TEST(WhenDynamicCastToTest, AmbiguousCast) {
TEST
(
WhenDynamicCastToTest
,
Describe
)
{
TEST
(
WhenDynamicCastToTest
,
Describe
)
{
Matcher
<
Base
*>
matcher
=
WhenDynamicCastTo
<
Derived
*>
(
Pointee
(
_
));
Matcher
<
Base
*>
matcher
=
WhenDynamicCastTo
<
Derived
*>
(
Pointee
(
_
));
#if GTEST_HAS_RTTI
const
std
::
string
prefix
=
const
std
::
string
prefix
=
"when dynamic_cast to "
+
internal
::
GetTypeName
<
Derived
*>
()
+
", "
;
"when dynamic_cast to "
+
internal
::
GetTypeName
<
Derived
*>
()
+
", "
;
#else // GTEST_HAS_RTTI
const
std
::
string
prefix
=
"when dynamic_cast, "
;
#endif // GTEST_HAS_RTTI
EXPECT_EQ
(
prefix
+
"points to a value that is anything"
,
Describe
(
matcher
));
EXPECT_EQ
(
prefix
+
"points to a value that is anything"
,
Describe
(
matcher
));
EXPECT_EQ
(
prefix
+
"does not point to a value that is anything"
,
EXPECT_EQ
(
prefix
+
"does not point to a value that is anything"
,
DescribeNegation
(
matcher
));
DescribeNegation
(
matcher
));
...
@@ -3799,6 +3814,7 @@ TEST(WhenDynamicCastToTest, BadReference) {
...
@@ -3799,6 +3814,7 @@ TEST(WhenDynamicCastToTest, BadReference) {
Base
&
as_base_ref
=
derived
;
Base
&
as_base_ref
=
derived
;
EXPECT_THAT
(
as_base_ref
,
Not
(
WhenDynamicCastTo
<
const
OtherDerived
&>
(
_
)));
EXPECT_THAT
(
as_base_ref
,
Not
(
WhenDynamicCastTo
<
const
OtherDerived
&>
(
_
)));
}
}
#endif // GTEST_HAS_RTTI
// Minimal const-propagating pointer.
// Minimal const-propagating pointer.
template
<
typename
T
>
template
<
typename
T
>
...
@@ -4222,13 +4238,17 @@ TEST(PropertyTest, WorksForReferenceToConstProperty) {
...
@@ -4222,13 +4238,17 @@ TEST(PropertyTest, WorksForReferenceToConstProperty) {
// ref-qualified.
// ref-qualified.
TEST
(
PropertyTest
,
WorksForRefQualifiedProperty
)
{
TEST
(
PropertyTest
,
WorksForRefQualifiedProperty
)
{
Matcher
<
const
AClass
&>
m
=
Property
(
&
AClass
::
s_ref
,
StartsWith
(
"hi"
));
Matcher
<
const
AClass
&>
m
=
Property
(
&
AClass
::
s_ref
,
StartsWith
(
"hi"
));
Matcher
<
const
AClass
&>
m_with_name
=
Property
(
"s"
,
&
AClass
::
s_ref
,
StartsWith
(
"hi"
));
AClass
a
;
AClass
a
;
a
.
set_s
(
"hill"
);
a
.
set_s
(
"hill"
);
EXPECT_TRUE
(
m
.
Matches
(
a
));
EXPECT_TRUE
(
m
.
Matches
(
a
));
EXPECT_TRUE
(
m_with_name
.
Matches
(
a
));
a
.
set_s
(
"hole"
);
a
.
set_s
(
"hole"
);
EXPECT_FALSE
(
m
.
Matches
(
a
));
EXPECT_FALSE
(
m
.
Matches
(
a
));
EXPECT_FALSE
(
m_with_name
.
Matches
(
a
));
}
}
#endif
#endif
...
@@ -4572,7 +4592,7 @@ TEST(ResultOfTest, WorksForFunctors) {
...
@@ -4572,7 +4592,7 @@ TEST(ResultOfTest, WorksForFunctors) {
}
}
// Tests that ResultOf(f, ...) compiles and works as expected when f is a
// Tests that ResultOf(f, ...) compiles and works as expected when f is a
// functor with more th
e
n one operator() defined. ResultOf() must work
// functor with more th
a
n one operator() defined. ResultOf() must work
// for each defined operator().
// for each defined operator().
struct
PolymorphicFunctor
{
struct
PolymorphicFunctor
{
typedef
int
result_type
;
typedef
int
result_type
;
...
@@ -6766,4 +6786,3 @@ TEST(NotTest, WorksOnMoveOnlyType) {
...
@@ -6766,4 +6786,3 @@ TEST(NotTest, WorksOnMoveOnlyType) {
}
// namespace gmock_matchers_test
}
// namespace gmock_matchers_test
}
// namespace testing
}
// namespace testing
googlemock/test/gmock_ex_test.cc
View file @
1cd979a8
...
@@ -34,9 +34,11 @@
...
@@ -34,9 +34,11 @@
#include "gmock/gmock.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "gtest/gtest.h"
#if GTEST_HAS_EXCEPTIONS
namespace
{
namespace
{
using
testing
::
HasSubstr
;
using
testing
::
HasSubstr
;
using
testing
::
internal
::
GoogleTestFailureException
;
using
testing
::
internal
::
GoogleTestFailureException
;
// A type that cannot be default constructed.
// A type that cannot be default constructed.
...
@@ -52,8 +54,6 @@ class MockFoo {
...
@@ -52,8 +54,6 @@ class MockFoo {
MOCK_METHOD0
(
GetNonDefaultConstructible
,
NonDefaultConstructible
());
MOCK_METHOD0
(
GetNonDefaultConstructible
,
NonDefaultConstructible
());
};
};
#if GTEST_HAS_EXCEPTIONS
TEST
(
DefaultValueTest
,
ThrowsRuntimeErrorWhenNoDefaultValue
)
{
TEST
(
DefaultValueTest
,
ThrowsRuntimeErrorWhenNoDefaultValue
)
{
MockFoo
mock
;
MockFoo
mock
;
try
{
try
{
...
@@ -76,6 +76,6 @@ TEST(DefaultValueTest, ThrowsRuntimeErrorWhenNoDefaultValue) {
...
@@ -76,6 +76,6 @@ TEST(DefaultValueTest, ThrowsRuntimeErrorWhenNoDefaultValue) {
}
}
}
}
#endif
}
// unnamed namespace
}
// unnamed namespace
#endif
googlemock/test/gmock_leak_test.py
View file @
1cd979a8
...
@@ -33,10 +33,8 @@
...
@@ -33,10 +33,8 @@
__author__
=
'wan@google.com (Zhanyong Wan)'
__author__
=
'wan@google.com (Zhanyong Wan)'
import
gmock_test_utils
import
gmock_test_utils
PROGRAM_PATH
=
gmock_test_utils
.
GetTestExecutablePath
(
'gmock_leak_test_'
)
PROGRAM_PATH
=
gmock_test_utils
.
GetTestExecutablePath
(
'gmock_leak_test_'
)
TEST_WITH_EXPECT_CALL
=
[
PROGRAM_PATH
,
'--gtest_filter=*ExpectCall*'
]
TEST_WITH_EXPECT_CALL
=
[
PROGRAM_PATH
,
'--gtest_filter=*ExpectCall*'
]
TEST_WITH_ON_CALL
=
[
PROGRAM_PATH
,
'--gtest_filter=*OnCall*'
]
TEST_WITH_ON_CALL
=
[
PROGRAM_PATH
,
'--gtest_filter=*OnCall*'
]
...
...
Prev
1
2
3
4
5
6
Next
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