Googletest export
Update auto_mock to support C++17 nested namespaces PiperOrigin-RevId: 318192214
This commit is contained in:
parent
849ed6b172
commit
05c4a036bb
@ -1599,12 +1599,11 @@ class AstBuilder(object):
|
||||
bases, templated_types, body, self.namespace_stack)
|
||||
|
||||
def handle_namespace(self):
|
||||
token = self._GetNextToken()
|
||||
# Support anonymous namespaces.
|
||||
name = None
|
||||
if token.token_type == tokenize.NAME:
|
||||
name = token.name
|
||||
token = self._GetNextToken()
|
||||
name_tokens, token = self.GetName()
|
||||
if name_tokens:
|
||||
name = ''.join([t.name for t in name_tokens])
|
||||
self.namespace_stack.append(name)
|
||||
assert token.token_type == tokenize.SYNTAX, token
|
||||
# Create an internal token that denotes when the namespace is complete.
|
||||
|
@ -361,26 +361,26 @@ class GenerateMocksTest(TestCase):
|
||||
source = """
|
||||
namespace Foo {
|
||||
namespace Bar { class Forward; }
|
||||
namespace Baz {
|
||||
namespace Baz::Qux {
|
||||
|
||||
class Test {
|
||||
public:
|
||||
virtual void Foo();
|
||||
};
|
||||
|
||||
} // namespace Baz
|
||||
} // namespace Baz::Qux
|
||||
} // namespace Foo
|
||||
"""
|
||||
expected = """\
|
||||
namespace Foo {
|
||||
namespace Baz {
|
||||
namespace Baz::Qux {
|
||||
|
||||
class MockTest : public Test {
|
||||
public:
|
||||
MOCK_METHOD(void, Foo, (), (override));
|
||||
};
|
||||
|
||||
} // namespace Baz
|
||||
} // namespace Baz::Qux
|
||||
} // namespace Foo
|
||||
"""
|
||||
self.assertEqualIgnoreLeadingWhitespace(expected,
|
||||
|
Loading…
Reference in New Issue
Block a user