Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
713b0778
Commit
713b0778
authored
Aug 10, 2017
by
Josh Bodily
Browse files
Fix scoped enum not working in gmock-gen.py
parent
75f0723c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
googlemock/scripts/generator/cpp/ast.py
googlemock/scripts/generator/cpp/ast.py
+3
-0
googlemock/scripts/generator/cpp/gmock_class_test.py
googlemock/scripts/generator/cpp/gmock_class_test.py
+18
-0
No files found.
googlemock/scripts/generator/cpp/ast.py
View file @
713b0778
...
...
@@ -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
):
...
...
googlemock/scripts/generator/cpp/gmock_class_test.py
View file @
713b0778
...
...
@@ -440,6 +440,24 @@ public:
MOCK_METHOD1(Bar,
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
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment