This is just for documentation. I recently spent some time of investigation why MOCK_METHOD stops compiling after adding new argument to function type. It occured that limit for arguments number is 15 which is nowhere documented (maybe it is but I cannot find it.
Describe the proposal.
Add information that MOCK_METHOD macro has limit when talking about number of arguments.
And that this limit current is 15.
This can be in form of FAQ and just short info in MOCK_METHOD doc.
For FAQ I'd propose to add this QA:
Q: I encounter this error .... while adding new argument to function mocked by MOCK_METHOD macro. What does it mean and how to work around this issue?
A:
You crossed the limit of 15 arguments in function mocked by MOCK_METHOD macro.
You can work around this limit by the following methods:
The best is to refactor your code - 15 is quite the enough number as for function arguments...
Other solution - if you have arguments that are irrelevant - always substituted by any matcher ::testing::_ - then your mocked function can just have subset of arguments:
void func(int a1, ..., int a16) override { mocked_func(a1, ... , a15); }
MOCK_METHOD(mocked_func, void, (int a1, .., int a15), ());
OR - you can have MOCK_METHOD that takes std::tuple of its arguments:
Ret func(T1 a1, ...., T19 a19) override { return mocked_func(std::tuple<T1, ..., T19>(a1, ..., a19)); }
MOCK_METHOD(mocked_func, Ret, ((std::tuple<T1, ..., T19>)), ());
And use FieldsAre to match this packed arguments - but here again - we have limit of 19 when using FieldsAre (as I can see in the code)
Is the feature specific to an operating system, compiler, or build system version?
Does the feature exist in the most recent commit?
No
Why do we need this feature?
This is just for documentation. I recently spent some time of investigation why MOCK_METHOD stops compiling after adding new argument to function type. It occured that limit for arguments number is 15 which is nowhere documented (maybe it is but I cannot find it.
Describe the proposal.
Add information that MOCK_METHOD macro has limit when talking about number of arguments. And that this limit current is 15. This can be in form of FAQ and just short info in MOCK_METHOD doc.
For FAQ I'd propose to add this QA:
Q: I encounter this error .... while adding new argument to function mocked by MOCK_METHOD macro. What does it mean and how to work around this issue?
A: You crossed the limit of 15 arguments in function mocked by MOCK_METHOD macro. You can work around this limit by the following methods:
Is the feature specific to an operating system, compiler, or build system version?
No