From 8e838ce0fd145431b433f534c71bdb7f5d6b11ac Mon Sep 17 00:00:00 2001 From: kosak Date: Thu, 8 Jan 2015 02:48:08 +0000 Subject: Adding support to gmock_gen for nested templates. --- scripts/generator/cpp/gmock_class_test.py | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'scripts/generator/cpp/gmock_class_test.py') diff --git a/scripts/generator/cpp/gmock_class_test.py b/scripts/generator/cpp/gmock_class_test.py index 27eb86c8..018f90a6 100755 --- a/scripts/generator/cpp/gmock_class_test.py +++ b/scripts/generator/cpp/gmock_class_test.py @@ -407,6 +407,42 @@ void()); self.assertEqualIgnoreLeadingWhitespace( expected, self.GenerateMocks(source)) + def testTemplateInATemplateTypedef(self): + source = """ +class Test { + public: + typedef std::vector> 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>&, 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__': unittest.main() -- cgit v1.2.3