From 5b3039e82752e9b1863103f28eaf5865c19f94db Mon Sep 17 00:00:00 2001 From: "Manikandan K. S." Date: Sun, 2 Aug 2026 12:18:50 +0530 Subject: [PATCH] docs: document MOCK_METHOD argument limit Fixes #4608 MOCK_METHOD accepts at most 31 arguments (doubled from 15 by dc3c9eda). Document this limit in gmock_cook_book.md and the MOCK_METHOD reference. --- docs/gmock_cook_book.md | 2 ++ docs/reference/mocking.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docs/gmock_cook_book.md b/docs/gmock_cook_book.md index cee1da8e..6063ec29 100644 --- a/docs/gmock_cook_book.md +++ b/docs/gmock_cook_book.md @@ -15,6 +15,8 @@ brevity, but you should do it in your own code. Mock classes are defined as normal classes, using the `MOCK_METHOD` macro to generate mocked methods. The macro gets 3 or 4 parameters: +Note that a mocked method can have at most 31 arguments. + ```cpp class MyMock { public: diff --git a/docs/reference/mocking.md b/docs/reference/mocking.md index ab37ebf3..3b01f9fd 100644 --- a/docs/reference/mocking.md +++ b/docs/reference/mocking.md @@ -16,6 +16,8 @@ GoogleTest defines the following macros for working with mocks. Defines a mock method *`method_name`* with arguments `(`*`args...`*`)` and return type *`return_type`* within a mock class. +The number of arguments is limited to 31. + The parameters of `MOCK_METHOD` mirror the method declaration. The optional fourth parameter *`specs...`* is a comma-separated list of qualifiers. The following qualifiers are accepted: