Adding support to gmock_gen for nested templates.
This commit is contained in:
parent
6b81780310
commit
8e838ce0fd
@ -496,9 +496,10 @@ class TypeConverter(object):
|
|||||||
else:
|
else:
|
||||||
names.append(t.name)
|
names.append(t.name)
|
||||||
name = ''.join(names)
|
name = ''.join(names)
|
||||||
result.append(Type(name_tokens[0].start, name_tokens[-1].end,
|
if name_tokens:
|
||||||
name, templated_types, modifiers,
|
result.append(Type(name_tokens[0].start, name_tokens[-1].end,
|
||||||
reference, pointer, array))
|
name, templated_types, modifiers,
|
||||||
|
reference, pointer, array))
|
||||||
del name_tokens[:]
|
del name_tokens[:]
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
|
@ -407,6 +407,42 @@ void());
|
|||||||
self.assertEqualIgnoreLeadingWhitespace(
|
self.assertEqualIgnoreLeadingWhitespace(
|
||||||
expected, self.GenerateMocks(source))
|
expected, self.GenerateMocks(source))
|
||||||
|
|
||||||
|
def testTemplateInATemplateTypedef(self):
|
||||||
|
source = """
|
||||||
|
class Test {
|
||||||
|
public:
|
||||||
|
typedef std::vector<std::list<int>> FooType;
|
||||||
|
virtual void Bar(const FooType& test_arg);
|
||||||
|
};
|
||||||
|
"""
|
||||||
|
expected = """\
|
||||||
|
class MockTest : public Test {
|
||||||
|
public:
|
||||||
|
MOCK_METHOD1(Bar,
|
||||||
|
void(const FooType& test_arg));
|
||||||
|
};
|
||||||
|
"""
|
||||||
|
self.assertEqualIgnoreLeadingWhitespace(
|
||||||
|
expected, self.GenerateMocks(source))
|
||||||
|
|
||||||
|
def testTemplateInATemplateTypedefWithComma(self):
|
||||||
|
source = """
|
||||||
|
class Test {
|
||||||
|
public:
|
||||||
|
typedef std::function<void(
|
||||||
|
const vector<std::list<int>>&, int> FooType;
|
||||||
|
virtual void Bar(const FooType& test_arg);
|
||||||
|
};
|
||||||
|
"""
|
||||||
|
expected = """\
|
||||||
|
class MockTest : public Test {
|
||||||
|
public:
|
||||||
|
MOCK_METHOD1(Bar,
|
||||||
|
void(const FooType& test_arg));
|
||||||
|
};
|
||||||
|
"""
|
||||||
|
self.assertEqualIgnoreLeadingWhitespace(
|
||||||
|
expected, self.GenerateMocks(source))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
@ -173,7 +173,7 @@ def GetTokens(source):
|
|||||||
token_type = SYNTAX
|
token_type = SYNTAX
|
||||||
i += 1
|
i += 1
|
||||||
new_ch = source[i]
|
new_ch = source[i]
|
||||||
if new_ch == c:
|
if new_ch == c and c != '>': # Treat ">>" as two tokens.
|
||||||
i += 1
|
i += 1
|
||||||
elif c == '-' and new_ch == '>':
|
elif c == '-' and new_ch == '>':
|
||||||
i += 1
|
i += 1
|
||||||
|
Loading…
Reference in New Issue
Block a user