gmock-global
gmock-global copied to clipboard
Compatibility with GoogleTest v1.10
Please update the project to be compatible with new powerful MOCK_METHOD macro introduced in GoogleTest release v1.10.0.
Commit https://github.com/google/googletest/commit/fbf67a70d07543f40832d0cd7a58f304bc6ab1d1 removed GMOCK_RESULT_
So if you need to compile with current head you should define
#if !defined(GMOCK_RESULT_)
#define GMOCK_RESULT_(tn, ...) \
tn ::testing::internal::Function<__VA_ARGS__>::Result
#endif
@pmisik Sorry I don't quite understand, if I do these steps, then will it be compatible with gtest v1.10.0?
For the version of googletest I used, I added this patch to the top of the file:
#if !defined(GMOCK_RESULT_)
#define GMOCK_RESULT_(tn, ...) \
tn ::testing::internal::Function<__VA_ARGS__>::Result
#endif
#if !defined(GMOCK_ARG_)
#define GMOCK_ARG_(tn, N, ...) \
tn ::testing::internal::Function<__VA_ARGS__>::Arg<N-1>::type
#endif
#if !defined(GMOCK_MATCHER_)
#define GMOCK_MATCHER_(tn, N, ...) \
const ::testing::Matcher<GMOCK_ARG_(tn, N, __VA_ARGS__)>&
#endif
#if !defined(GMOCK_MOCKER_)
#define GMOCK_MOCKER_(arity, Method) \
GTEST_CONCAT_TOKEN_(gmock##arity##_##Method##_, __LINE__)
#endif
For the version of googletest I used, I added this patch to the top of the file:
#if !defined(GMOCK_RESULT_) #define GMOCK_RESULT_(tn, ...) \ tn ::testing::internal::Function<__VA_ARGS__>::Result #endif #if !defined(GMOCK_ARG_) #define GMOCK_ARG_(tn, N, ...) \ tn ::testing::internal::Function<__VA_ARGS__>::Arg<N-1>::type #endif #if !defined(GMOCK_MATCHER_) #define GMOCK_MATCHER_(tn, N, ...) \ const ::testing::Matcher<GMOCK_ARG_(tn, N, __VA_ARGS__)>& #endif #if !defined(GMOCK_MOCKER_) #define GMOCK_MOCKER_(arity, Method) \ GTEST_CONCAT_TOKEN_(gmock##arity##_##Method##_, __LINE__) #endif
What file did you add those to the top of? Was it your file containing mocks, or was it the header file for this project?
@AeroSW Could you elaborate on the issue? What's not working?
@AeroSW Could you elaborate on the issue? What's not working?
@SergiusTheBest Everything is working. It took me a few minutes to realize the changes mentioned above are merged into the code. I thought he was talking about adding that code to his own project.
Ok. Then I assume the issue can be closed. I've updated the CI script to be sure it builds with gtest 1.8.1-1.15.2 on gcc/clang/msvc.