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
c62c7943
Unverified
Commit
c62c7943
authored
Jul 20, 2018
by
Gennadiy Civil
Committed by
GitHub
Jul 20, 2018
Browse files
Merge pull request #1668 from duxiuxing/googletest_for_asam
Fix warning C4819 in Visual Studio
parents
6ce9b98f
d8db0ca9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
25 deletions
+25
-25
googlemock/docs/CookBook.md
googlemock/docs/CookBook.md
+2
-2
googlemock/include/gmock/gmock-generated-function-mockers.h
googlemock/include/gmock/gmock-generated-function-mockers.h
+2
-2
googlemock/include/gmock/gmock-generated-function-mockers.h.pump
...ock/include/gmock/gmock-generated-function-mockers.h.pump
+2
-2
googlemock/include/gmock/gmock-spec-builders.h
googlemock/include/gmock/gmock-spec-builders.h
+18
-18
googlemock/include/gmock/internal/gmock-internal-utils.h
googlemock/include/gmock/internal/gmock-internal-utils.h
+1
-1
No files found.
googlemock/docs/CookBook.md
View file @
c62c7943
...
@@ -2247,7 +2247,7 @@ enum class AccessLevel { kInternal, kPublic };
...
@@ -2247,7 +2247,7 @@ enum class AccessLevel { kInternal, kPublic };
class
Buzz
{
class
Buzz
{
public:
public:
explicit
Buzz
(
AccessLevel
access
)
{
…
}
explicit
Buzz
(
AccessLevel
access
)
{
...
}
...
...
};
};
...
@@ -2320,7 +2320,7 @@ Note that `ByMove()` is essential here - if you drop it, the code won’t compil
...
@@ -2320,7 +2320,7 @@ Note that `ByMove()` is essential here - if you drop it, the code won’t compil
Quiz time! What do you think will happen if a
`Return(ByMove(...))`
action is
Quiz time! What do you think will happen if a
`Return(ByMove(...))`
action is
performed more than once (e.g. you write
performed more than once (e.g. you write
`
…
.WillRepeatedly(Return(ByMove(...)));`
)? Come think of it, after the first
`.WillRepeatedly(Return(ByMove(...)));`
)? Come think of it, after the first
time the action runs, the source value will be consumed (since it’s a move-only
time the action runs, the source value will be consumed (since it’s a move-only
value), so the next time around, there’s no value to move from -- you’ll get a
value), so the next time around, there’s no value to move from -- you’ll get a
run-time error that
`Return(ByMove(...))`
can only be run once.
run-time error that
`Return(ByMove(...))`
can only be run once.
...
...
googlemock/include/gmock/gmock-generated-function-mockers.h
View file @
c62c7943
...
@@ -352,7 +352,7 @@ class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> : public
...
@@ -352,7 +352,7 @@ class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> : public
//
//
// class MockClass {
// class MockClass {
// // Overload 1
// // Overload 1
// MockSpec<string&()> gmock_GetName() {
…
}
// MockSpec<string&()> gmock_GetName() {
...
}
// // Overload 2. Declared const so that the compiler will generate an
// // Overload 2. Declared const so that the compiler will generate an
// // error when trying to resolve between this and overload 4 in
// // error when trying to resolve between this and overload 4 in
// // 'gmock_GetName(WithoutMatchers(), nullptr)'.
// // 'gmock_GetName(WithoutMatchers(), nullptr)'.
...
@@ -363,7 +363,7 @@ class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> : public
...
@@ -363,7 +363,7 @@ class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> : public
// }
// }
//
//
// // Overload 3
// // Overload 3
// const string& gmock_GetName() const {
…
}
// const string& gmock_GetName() const {
...
}
// // Overload 4
// // Overload 4
// MockSpec<const string&()> gmock_GetName(
// MockSpec<const string&()> gmock_GetName(
// const WithoutMatchers&, const Function<const string&()>*) const {
// const WithoutMatchers&, const Function<const string&()>*) const {
...
...
googlemock/include/gmock/gmock-generated-function-mockers.h.pump
View file @
c62c7943
...
@@ -114,7 +114,7 @@ class FunctionMocker<R($As)> : public
...
@@ -114,7 +114,7 @@ class FunctionMocker<R($As)> : public
//
//
// class MockClass {
// class MockClass {
// // Overload 1
// // Overload 1
// MockSpec<string&()> gmock_GetName() {
…
}
// MockSpec<string&()> gmock_GetName() {
...
}
// // Overload 2. Declared const so that the compiler will generate an
// // Overload 2. Declared const so that the compiler will generate an
// // error when trying to resolve between this and overload 4 in
// // error when trying to resolve between this and overload 4 in
// // 'gmock_GetName(WithoutMatchers(), nullptr)'.
// // 'gmock_GetName(WithoutMatchers(), nullptr)'.
...
@@ -125,7 +125,7 @@ class FunctionMocker<R($As)> : public
...
@@ -125,7 +125,7 @@ class FunctionMocker<R($As)> : public
// }
// }
//
//
// // Overload 3
// // Overload 3
// const string& gmock_GetName() const {
…
}
// const string& gmock_GetName() const {
...
}
// // Overload 4
// // Overload 4
// MockSpec<const string&()> gmock_GetName(
// MockSpec<const string&()> gmock_GetName(
// const WithoutMatchers&, const Function<const string&()>*) const {
// const WithoutMatchers&, const Function<const string&()>*) const {
...
...
googlemock/include/gmock/gmock-spec-builders.h
View file @
c62c7943
...
@@ -1854,22 +1854,22 @@ inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT
...
@@ -1854,22 +1854,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 +1877,28 @@ inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT
...
@@ -1877,28 +1877,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/internal/gmock-internal-utils.h
View file @
c62c7943
...
@@ -348,7 +348,7 @@ GTEST_API_ void Log(LogSeverity severity, const std::string& message,
...
@@ -348,7 +348,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:
...
...
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