aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2011-02-01 00:00:03 +0000
committerzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2011-02-01 00:00:03 +0000
commit5b61ce3ee5b15e6356487dd97236bf663a96a391 (patch)
tree20aab5205844d171c2fb89eba88404a1e5f047eb /scripts
parenta684b5a5269e3f9c53ef842bf9b9658370418a0c (diff)
downloadgoogletest-5b61ce3ee5b15e6356487dd97236bf663a96a391.tar.gz
googletest-5b61ce3ee5b15e6356487dd97236bf663a96a391.tar.bz2
googletest-5b61ce3ee5b15e6356487dd97236bf663a96a391.zip
Picks up gtest r536; renames implicit_cast and down_cast to reduce the chance of clash (by Roman Perepelitsa); enables gmock_gen.py to handle storage specifiers (by Steve Fox).
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generator/cpp/ast.py8
-rwxr-xr-xscripts/generator/cpp/gmock_class_test.py16
-rwxr-xr-xscripts/gmock_doctor.py8
3 files changed, 27 insertions, 5 deletions
diff --git a/scripts/generator/cpp/ast.py b/scripts/generator/cpp/ast.py
index 47dc9a07..6f61f877 100755
--- a/scripts/generator/cpp/ast.py
+++ b/scripts/generator/cpp/ast.py
@@ -1483,7 +1483,13 @@ class AstBuilder(object):
assert class_token.token_type == tokenize.SYNTAX, class_token
token = class_token
else:
- self._AddBackToken(class_token)
+ # Skip any macro (e.g. storage class specifiers) after the
+ # 'class' keyword.
+ next_token = self._GetNextToken()
+ if next_token.token_type == tokenize.NAME:
+ self._AddBackToken(next_token)
+ else:
+ self._AddBackTokens([class_token, next_token])
name_tokens, token = self.GetName()
class_name = ''.join([t.name for t in name_tokens])
bases = None
diff --git a/scripts/generator/cpp/gmock_class_test.py b/scripts/generator/cpp/gmock_class_test.py
index 607d5cf7..494720cd 100755
--- a/scripts/generator/cpp/gmock_class_test.py
+++ b/scripts/generator/cpp/gmock_class_test.py
@@ -193,6 +193,22 @@ void());
self.assertEqualIgnoreLeadingWhitespace(
expected, self.GenerateMocks(source))
+ def testClassWithStorageSpecifierMacro(self):
+ source = """
+class STORAGE_SPECIFIER Test {
+ public:
+ virtual void Foo();
+};
+"""
+ expected = """\
+class MockTest : public Test {
+public:
+MOCK_METHOD0(Foo,
+void());
+};
+"""
+ self.assertEqualIgnoreLeadingWhitespace(
+ expected, self.GenerateMocks(source))
if __name__ == '__main__':
unittest.main()
diff --git a/scripts/gmock_doctor.py b/scripts/gmock_doctor.py
index 15e2433c..f7932b5e 100755
--- a/scripts/gmock_doctor.py
+++ b/scripts/gmock_doctor.py
@@ -169,7 +169,7 @@ def _NeedToReturnReferenceDiagnoser(msg):
gcc_regex = (r'In member function \'testing::internal::ReturnAction<R>.*\n'
+ _GCC_FILE_LINE_RE + r'instantiated from here\n'
r'.*gmock-actions\.h.*error: creating array with negative size')
- clang_regex = (r'error: array size is negative\r?\n'
+ clang_regex = (r'error:.*array.*negative.*\r?\n'
r'(.*\n)*?' +
_CLANG_NON_GMOCK_FILE_LINE_RE +
r'note: in instantiation of function template specialization '
@@ -414,10 +414,10 @@ def _NeedToUseReturnNullDiagnoser(msg):
gcc_regex = ('instantiated from \'testing::internal::ReturnAction<R>'
'::operator testing::Action<Func>\(\) const.*\n' +
_GCC_FILE_LINE_RE + r'instantiated from here\n'
- r'.*error: no matching function for call to \'implicit_cast\('
+ r'.*error: no matching function for call to \'ImplicitCast_\('
r'long int&\)')
clang_regex = (r'\bgmock-actions.h:.* error: no matching function for '
- r'call to \'implicit_cast\'\r?\n'
+ r'call to \'ImplicitCast_\'\r?\n'
r'(.*\n)*?' +
_CLANG_NON_GMOCK_FILE_LINE_RE + r'note: in instantiation '
r'of function template specialization '
@@ -501,7 +501,7 @@ def _WrongMockMethodMacroDiagnoser(msg):
r'.*\n'
r'.*candidates are.*FunctionMocker<[^>]+A(?P<args>\d+)\)>')
clang_regex = (_CLANG_NON_GMOCK_FILE_LINE_RE +
- r'error: array size is negative\r?\n'
+ r'error:.*array.*negative.*r?\n'
r'(.*\n)*?'
r'(?P=file):(?P=line):(?P=column): error: too few arguments '
r'to function call, expected (?P<args>\d+), '