diff options
| author | Jonathan Wendeborn <jonathan.wendeborn@bruker.com> | 2018-10-16 08:38:34 +0200 | 
|---|---|---|
| committer | Jonathan Wendeborn <jonathan.wendeborn@bruker.com> | 2018-10-16 08:38:34 +0200 | 
| commit | 96d16157721cda1fd6981e6ce70645acb44220da (patch) | |
| tree | c68f2939aaf8904f06e7235dfa4607f167fbb758 /googlemock/scripts/generator | |
| parent | 386391b0144201e0cf5f66d8ba1cb60a1076f673 (diff) | |
| parent | 8c82ba48e433005b9e25835b4a342ef4dcc0cfc0 (diff) | |
| download | googletest-96d16157721cda1fd6981e6ce70645acb44220da.tar.gz googletest-96d16157721cda1fd6981e6ce70645acb44220da.tar.bz2 googletest-96d16157721cda1fd6981e6ce70645acb44220da.zip | |
Merge branch 'isnice' of https://github.com/BrukerJWD/googletest into isnice
Diffstat (limited to 'googlemock/scripts/generator')
| -rw-r--r-- | googlemock/scripts/generator/README | 9 | ||||
| -rwxr-xr-x | googlemock/scripts/generator/cpp/ast.py | 9 | ||||
| -rwxr-xr-x | googlemock/scripts/generator/cpp/gmock_class_test.py | 18 | 
3 files changed, 28 insertions, 8 deletions
| diff --git a/googlemock/scripts/generator/README b/googlemock/scripts/generator/README index d6f95974..01fd463d 100644 --- a/googlemock/scripts/generator/README +++ b/googlemock/scripts/generator/README @@ -1,11 +1,10 @@  The Google Mock class generator is an application that is part of cppclean. -For more information about cppclean, see the README.cppclean file or -visit http://code.google.com/p/cppclean/ +For more information about cppclean, visit http://code.google.com/p/cppclean/ -cppclean requires Python 2.3.5 or later.  If you don't have Python installed -on your system, you will also need to install it.  You can download Python -from:  http://www.python.org/download/releases/ +The mock generator requires Python 2.3.5 or later.  If you don't have Python +installed on your system, you will also need to install it.  You can download +Python from:  http://www.python.org/download/releases/  To use the Google Mock class generator, you need to call it  on the command line passing the header file and class for which you want diff --git a/googlemock/scripts/generator/cpp/ast.py b/googlemock/scripts/generator/cpp/ast.py index 11cbe912..f14728b4 100755 --- a/googlemock/scripts/generator/cpp/ast.py +++ b/googlemock/scripts/generator/cpp/ast.py @@ -338,7 +338,7 @@ class Class(_GenericDeclaration):          # TODO(nnorwitz): handle namespaces, etc.          if self.bases:              for token_list in self.bases: -                # TODO(nnorwitz): bases are tokens, do name comparision. +                # TODO(nnorwitz): bases are tokens, do name comparison.                  for token in token_list:                      if token.name == node.name:                          return True @@ -381,7 +381,7 @@ class Function(_GenericDeclaration):      def Requires(self, node):          if self.parameters: -            # TODO(nnorwitz): parameters are tokens, do name comparision. +            # TODO(nnorwitz): parameters are tokens, do name comparison.              for p in self.parameters:                  if p.name == node.name:                      return True @@ -858,7 +858,7 @@ class AstBuilder(object):              last_token = self._GetNextToken()          return tokens, last_token -    # TODO(nnorwitz): remove _IgnoreUpTo() it shouldn't be necesary. +    # TODO(nnorwitz): remove _IgnoreUpTo() it shouldn't be necessary.      def _IgnoreUpTo(self, token_type, token):          unused_tokens = self._GetTokensUpTo(token_type, token) @@ -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): diff --git a/googlemock/scripts/generator/cpp/gmock_class_test.py b/googlemock/scripts/generator/cpp/gmock_class_test.py index 018f90a6..c53e6000 100755 --- a/googlemock/scripts/generator/cpp/gmock_class_test.py +++ b/googlemock/scripts/generator/cpp/gmock_class_test.py @@ -444,5 +444,23 @@ 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)) +  if __name__ == '__main__':    unittest.main() | 
