summaryrefslogtreecommitdiffstats
path: root/googlemock/scripts/generator
diff options
context:
space:
mode:
Diffstat (limited to 'googlemock/scripts/generator')
-rwxr-xr-xgooglemock/scripts/generator/cpp/ast.py3
-rwxr-xr-xgooglemock/scripts/generator/cpp/gmock_class_test.py18
2 files changed, 21 insertions, 0 deletions
diff --git a/googlemock/scripts/generator/cpp/ast.py b/googlemock/scripts/generator/cpp/ast.py
index cce3272..f14728b 100755
--- a/googlemock/scripts/generator/cpp/ast.py
+++ b/googlemock/scripts/generator/cpp/ast.py
@@ -1264,6 +1264,9 @@ class AstBuilder(object):
return self._GetNestedType(Union)
def handle_enum(self):
+ token = self._GetNextToken()
+ if not (token.token_type == tokenize.NAME and token.name == 'class'):
+ self._AddBackToken(token)
return self._GetNestedType(Enum)
def handle_auto(self):
diff --git a/googlemock/scripts/generator/cpp/gmock_class_test.py b/googlemock/scripts/generator/cpp/gmock_class_test.py
index 018f90a..c53e600 100755
--- a/googlemock/scripts/generator/cpp/gmock_class_test.py
+++ b/googlemock/scripts/generator/cpp/gmock_class_test.py
@@ -444,5 +444,23 @@ void(const FooType& test_arg));
self.assertEqualIgnoreLeadingWhitespace(
expected, self.GenerateMocks(source))
+ def testEnumClass(self):
+ source = """
+class Test {
+ public:
+ enum class Baz { BAZINGA };
+ 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()