Commit 46b18857 by platisd

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
parent f3ef7e17
...@@ -132,7 +132,8 @@ def _GenerateMethods(output_lines, source, class_node): ...@@ -132,7 +132,8 @@ def _GenerateMethods(output_lines, source, class_node):
args = [] args = []
for p in node.parameters: for p in node.parameters:
arg = _GenerateArg(source[p.start:p.end]) arg = _GenerateArg(source[p.start:p.end])
args.append(_EscapeForMacro(arg)) if arg != 'void':
args.append(_EscapeForMacro(arg))
# Create the mock method definition. # Create the mock method definition.
output_lines.extend([ output_lines.extend([
......
...@@ -156,7 +156,7 @@ class Foo { ...@@ -156,7 +156,7 @@ class Foo {
}; };
""" """
self.assertEqualIgnoreLeadingWhitespace( self.assertEqualIgnoreLeadingWhitespace(
'MOCK_METHOD(int, Bar, (void), (override));', 'MOCK_METHOD(int, Bar, (), (override));',
self.GenerateMethodSource(source)) self.GenerateMethodSource(source))
def testStrangeNewlineInParameter(self): def testStrangeNewlineInParameter(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment