Merge pull request #1194 from joshbodily/josh/fix_scoped_class2
Fix scoped enum not working in gmock-gen.py
This commit is contained in:
		
						commit
						7db99f2ce4
					
				@ -1264,6 +1264,9 @@ class AstBuilder(object):
 | 
				
			|||||||
        return self._GetNestedType(Union)
 | 
					        return self._GetNestedType(Union)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def handle_enum(self):
 | 
					    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)
 | 
					        return self._GetNestedType(Enum)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def handle_auto(self):
 | 
					    def handle_auto(self):
 | 
				
			||||||
 | 
				
			|||||||
@ -440,6 +440,24 @@ public:
 | 
				
			|||||||
MOCK_METHOD1(Bar,
 | 
					MOCK_METHOD1(Bar,
 | 
				
			||||||
void(const FooType& test_arg));
 | 
					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(
 | 
					    self.assertEqualIgnoreLeadingWhitespace(
 | 
				
			||||||
        expected, self.GenerateMocks(source))
 | 
					        expected, self.GenerateMocks(source))
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user