summaryrefslogtreecommitdiffstats
path: root/googlemock/scripts
diff options
context:
space:
mode:
authorplatisd <platisd@users.noreply.github.com>2021-02-05 19:35:02 +0100
committerplatisd <platisd@users.noreply.github.com>2021-02-05 21:30:10 +0100
commit46b188577b9478215d8cf8ea2bde5e4946844f1f (patch)
tree9441b25e1b650395dd97d5d49d5ce1993a1eca08 /googlemock/scripts
parentf3ef7e173fd0853069f16c4b5afc7e80a350604b (diff)
downloadgoogletest-46b188577b9478215d8cf8ea2bde5e4946844f1f.tar.gz
googletest-46b188577b9478215d8cf8ea2bde5e4946844f1f.zip
Do not include void into mocked method arguments
If a function that takes no arguments explicitly states (void) then do not include it in the mocked method argument list since it triggers static assertions that expect no arguments to be present. Fixes (?) #3261
Diffstat (limited to 'googlemock/scripts')
-rwxr-xr-xgooglemock/scripts/generator/cpp/gmock_class.py3
-rwxr-xr-xgooglemock/scripts/generator/cpp/gmock_class_test.py2
2 files changed, 3 insertions, 2 deletions
diff --git a/googlemock/scripts/generator/cpp/gmock_class.py b/googlemock/scripts/generator/cpp/gmock_class.py
index c4d27934..3e21022b 100755
--- a/googlemock/scripts/generator/cpp/gmock_class.py
+++ b/googlemock/scripts/generator/cpp/gmock_class.py
@@ -132,7 +132,8 @@ def _GenerateMethods(output_lines, source, class_node):
args = []
for p in node.parameters:
arg = _GenerateArg(source[p.start:p.end])
- args.append(_EscapeForMacro(arg))
+ if arg != 'void':
+ args.append(_EscapeForMacro(arg))
# Create the mock method definition.
output_lines.extend([
diff --git a/googlemock/scripts/generator/cpp/gmock_class_test.py b/googlemock/scripts/generator/cpp/gmock_class_test.py
index 7d5e2f17..eff475f4 100755
--- a/googlemock/scripts/generator/cpp/gmock_class_test.py
+++ b/googlemock/scripts/generator/cpp/gmock_class_test.py
@@ -156,7 +156,7 @@ class Foo {
};
"""
self.assertEqualIgnoreLeadingWhitespace(
- 'MOCK_METHOD(int, Bar, (void), (override));',
+ 'MOCK_METHOD(int, Bar, (), (override));',
self.GenerateMethodSource(source))
def testStrangeNewlineInParameter(self):
OpenPOWER on IntegriCloud