diff options
author | Abseil Team <absl-team@google.com> | 2020-02-03 17:09:02 (GMT) |
---|---|---|
committer | Andy Getz <durandal@google.com> | 2020-02-07 18:35:10 (GMT) |
commit | d02e2772750f39450eab16c3cf2ec9a609be8980 (patch) | |
tree | b0e0cbef7a3670f6b8b399af500d399b7ea24ecf /googlemock/include/gmock/gmock-generated-function-mockers.h.pump | |
parent | 4f6609129a2ffe83308406655f770352cbbfd6b6 (diff) | |
download | googletest-d02e2772750f39450eab16c3cf2ec9a609be8980.zip googletest-d02e2772750f39450eab16c3cf2ec9a609be8980.tar.gz googletest-d02e2772750f39450eab16c3cf2ec9a609be8980.tar.bz2 |
Googletest export
Pass method's parameters count to internal GMOCK_METHOD* macro.
This will help removing copypaste in every GMOCK_METHOD* macro in future.
PiperOrigin-RevId: 292932554
Diffstat (limited to 'googlemock/include/gmock/gmock-generated-function-mockers.h.pump')
-rw-r--r-- | googlemock/include/gmock/gmock-generated-function-mockers.h.pump | 75 |
1 files changed, 12 insertions, 63 deletions
diff --git a/googlemock/include/gmock/gmock-generated-function-mockers.h.pump b/googlemock/include/gmock/gmock-generated-function-mockers.h.pump index a56e132..d240a89 100644 --- a/googlemock/include/gmock/gmock-generated-function-mockers.h.pump +++ b/googlemock/include/gmock/gmock-generated-function-mockers.h.pump @@ -118,18 +118,18 @@ using internal::FunctionMocker; // commas (the same reason that we use variadic macros in other places // in this file). // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_RESULT_(tn, ...) \ - tn ::testing::internal::Function<__VA_ARGS__>::Result +#define GMOCK_RESULT_(...) \ + typename ::testing::internal::Function<__VA_ARGS__>::Result // The type of argument N of the given function type. // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_ARG_(tn, N, ...) \ - tn ::testing::internal::Function<__VA_ARGS__>::template Arg<N-1>::type +#define GMOCK_ARG_(N, ...) \ + typename ::testing::internal::Function<__VA_ARGS__>::template Arg<N-1>::type // The matcher type for argument N of the given function type. // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_MATCHER_(tn, N, ...) \ - const ::testing::Matcher<GMOCK_ARG_(tn, N, __VA_ARGS__)>& +#define GMOCK_MATCHER_(N, ...) \ + const ::testing::Matcher<GMOCK_ARG_(N, __VA_ARGS__)>& // The variable for mocking the given method. // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! @@ -139,18 +139,18 @@ using internal::FunctionMocker; $for i [[ $range j 1..i -$var arg_as = [[$for j, [[GMOCK_ARG_(tn, $j, __VA_ARGS__) gmock_a$j]]]] +$var arg_as = [[$for j, [[GMOCK_ARG_($j, __VA_ARGS__) gmock_a$j]]]] $var as = [[$for j, \ - [[::std::forward<GMOCK_ARG_(tn, $j, __VA_ARGS__)>(gmock_a$j)]]]] + [[::std::forward<GMOCK_ARG_($j, __VA_ARGS__)>(gmock_a$j)]]]] $var matcher_arg_as = [[$for j, \ - [[GMOCK_MATCHER_(tn, $j, __VA_ARGS__) gmock_a$j]]]] + [[GMOCK_MATCHER_($j, __VA_ARGS__) gmock_a$j]]]] $var matcher_as = [[$for j, [[gmock_a$j]]]] $var anything_matchers = [[$for j, \ - [[::testing::A<GMOCK_ARG_(tn, $j, __VA_ARGS__)>()]]]] + [[::testing::A<GMOCK_ARG_($j, __VA_ARGS__)>()]]]] // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! -#define GMOCK_METHOD$i[[]]_(tn, constness, ct, Method, ...) \ +#define GMOCK_METHOD$i[[]]_(constness, ct, Method, ...) \ static_assert($i == ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, "MOCK_METHOD<N> must match argument count.");\ - GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \ + GMOCK_RESULT_(__VA_ARGS__) ct Method( \ $arg_as) constness { \ GMOCK_MOCKER_($i, constness, Method).SetOwnerAndName(this, #Method); \ return GMOCK_MOCKER_($i, constness, Method).Invoke($as); \ @@ -170,57 +170,6 @@ $var anything_matchers = [[$for j, \ ]] -$for i [[ -#define MOCK_METHOD$i(m, ...) GMOCK_METHOD$i[[]]_(, , , m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_CONST_METHOD$i(m, ...) GMOCK_METHOD$i[[]]_(, const, , m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_METHOD$i[[]]_T(m, ...) GMOCK_METHOD$i[[]]_(typename, , , m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_CONST_METHOD$i[[]]_T(m, ...) \ - GMOCK_METHOD$i[[]]_(typename, const, , m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_METHOD$i[[]]_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD$i[[]]_(, , ct, m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_CONST_METHOD$i[[]]_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD$i[[]]_(, const, ct, m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD$i[[]]_(typename, , ct, m, __VA_ARGS__) - -]] - - -$for i [[ -#define MOCK_CONST_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, ...) \ - GMOCK_METHOD$i[[]]_(typename, const, ct, m, __VA_ARGS__) - -]] } // namespace testing |