summaryrefslogtreecommitdiffstats
path: root/googlemock
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2020-06-25 03:00:53 (GMT)
committerMark Barolak <mbar@google.com>2020-06-26 16:03:55 (GMT)
commit05c4a036bbed85ece96476e7cfc3ba2507567dd6 (patch)
treeef0b7a92be9b1eda72d42ec57c8c5c19881fb169 /googlemock
parent849ed6b172c70bce63763221559e1c74837619e3 (diff)
downloadgoogletest-05c4a036bbed85ece96476e7cfc3ba2507567dd6.zip
googletest-05c4a036bbed85ece96476e7cfc3ba2507567dd6.tar.gz
googletest-05c4a036bbed85ece96476e7cfc3ba2507567dd6.tar.bz2
Googletest export
Update auto_mock to support C++17 nested namespaces PiperOrigin-RevId: 318192214
Diffstat (limited to 'googlemock')
-rwxr-xr-xgooglemock/scripts/generator/cpp/ast.py7
-rwxr-xr-xgooglemock/scripts/generator/cpp/gmock_class_test.py8
2 files changed, 7 insertions, 8 deletions
diff --git a/googlemock/scripts/generator/cpp/ast.py b/googlemock/scripts/generator/cpp/ast.py
index b4890a5..cc9f89a 100755
--- a/googlemock/scripts/generator/cpp/ast.py
+++ b/googlemock/scripts/generator/cpp/ast.py
@@ -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.
diff --git a/googlemock/scripts/generator/cpp/gmock_class_test.py b/googlemock/scripts/generator/cpp/gmock_class_test.py
index 7465569..527182c 100755
--- a/googlemock/scripts/generator/cpp/gmock_class_test.py
+++ b/googlemock/scripts/generator/cpp/gmock_class_test.py
@@ -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,