aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/generator/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/generator/cpp')
-rwxr-xr-xscripts/generator/cpp/ast.py7
-rwxr-xr-xscripts/generator/cpp/gmock_class_test.py30
2 files changed, 33 insertions, 4 deletions
diff --git a/scripts/generator/cpp/ast.py b/scripts/generator/cpp/ast.py
index 38866717..9504cee5 100755
--- a/scripts/generator/cpp/ast.py
+++ b/scripts/generator/cpp/ast.py
@@ -598,10 +598,9 @@ class TypeConverter(object):
first_token = None
default = []
- def AddParameter():
+ def AddParameter(end):
if default:
del default[0] # Remove flag.
- end = type_modifiers[-1].end
parts = self.DeclarationToParts(type_modifiers, True)
(name, type_name, templated_types, modifiers,
unused_default, unused_other_tokens) = parts
@@ -625,7 +624,7 @@ class TypeConverter(object):
continue
if s.name == ',':
- AddParameter()
+ AddParameter(s.start)
name = type_name = ''
type_modifiers = []
pointer = reference = array = False
@@ -646,7 +645,7 @@ class TypeConverter(object):
default.append(s)
else:
type_modifiers.append(s)
- AddParameter()
+ AddParameter(tokens[-1].end)
return result
def CreateReturnType(self, return_type_seq):
diff --git a/scripts/generator/cpp/gmock_class_test.py b/scripts/generator/cpp/gmock_class_test.py
index 361dad7f..ae3739af 100755
--- a/scripts/generator/cpp/gmock_class_test.py
+++ b/scripts/generator/cpp/gmock_class_test.py
@@ -219,6 +219,36 @@ class Foo {
'MOCK_METHOD0_T(Bar,\nint());',
self.GenerateMethodSource(source))
+ def testPointerArgWithoutNames(self):
+ source = """
+class Foo {
+ virtual int Bar(C*);
+};
+"""
+ self.assertEqualIgnoreLeadingWhitespace(
+ 'MOCK_METHOD1(Bar,\nint(C*));',
+ self.GenerateMethodSource(source))
+
+ def testReferenceArgWithoutNames(self):
+ source = """
+class Foo {
+ virtual int Bar(C&);
+};
+"""
+ self.assertEqualIgnoreLeadingWhitespace(
+ 'MOCK_METHOD1(Bar,\nint(C&));',
+ self.GenerateMethodSource(source))
+
+ def testArrayArgWithoutNames(self):
+ source = """
+class Foo {
+ virtual int Bar(C[]);
+};
+"""
+ self.assertEqualIgnoreLeadingWhitespace(
+ 'MOCK_METHOD1(Bar,\nint(C[]));',
+ self.GenerateMethodSource(source))
+
class GenerateMocksTest(TestCase):