aboutsummaryrefslogtreecommitdiffstats
path: root/googlemock/scripts
diff options
context:
space:
mode:
authorJosh Bodily <joshbodily@gmail.com>2017-08-10 10:58:57 -0600
committerJosh Bodily <joshbodily@gmail.com>2017-08-10 10:58:57 -0600
commit713b0778709ba8ba2f8e437f0bbba16d57de7137 (patch)
treee53d35fb5ef2b2c048773b344f30972eb0fe07bb /googlemock/scripts
parent75f0723c4522ae70724d71b1facdde3ecdf35975 (diff)
downloadgoogletest-713b0778709ba8ba2f8e437f0bbba16d57de7137.tar.gz
googletest-713b0778709ba8ba2f8e437f0bbba16d57de7137.tar.bz2
googletest-713b0778709ba8ba2f8e437f0bbba16d57de7137.zip
Fix scoped enum not working in gmock-gen.py
Diffstat (limited to 'googlemock/scripts')
-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 11cbe912..95074488 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 018f90a6..c53e6000 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()