Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
8e838ce0
Commit
8e838ce0
authored
Jan 08, 2015
by
kosak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding support to gmock_gen for nested templates.
parent
6b817803
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
1 deletion
+38
-1
ast.py
scripts/generator/cpp/ast.py
+1
-0
gmock_class_test.py
scripts/generator/cpp/gmock_class_test.py
+36
-0
tokenize.py
scripts/generator/cpp/tokenize.py
+1
-1
No files found.
scripts/generator/cpp/ast.py
View file @
8e838ce0
...
@@ -496,6 +496,7 @@ class TypeConverter(object):
...
@@ -496,6 +496,7 @@ class TypeConverter(object):
else
:
else
:
names
.
append
(
t
.
name
)
names
.
append
(
t
.
name
)
name
=
''
.
join
(
names
)
name
=
''
.
join
(
names
)
if
name_tokens
:
result
.
append
(
Type
(
name_tokens
[
0
]
.
start
,
name_tokens
[
-
1
]
.
end
,
result
.
append
(
Type
(
name_tokens
[
0
]
.
start
,
name_tokens
[
-
1
]
.
end
,
name
,
templated_types
,
modifiers
,
name
,
templated_types
,
modifiers
,
reference
,
pointer
,
array
))
reference
,
pointer
,
array
))
...
...
scripts/generator/cpp/gmock_class_test.py
View file @
8e838ce0
...
@@ -407,6 +407,42 @@ void());
...
@@ -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
()
scripts/generator/cpp/tokenize.py
View file @
8e838ce0
...
@@ -173,7 +173,7 @@ def GetTokens(source):
...
@@ -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
...
...
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