Googletest export
Clarify explanation of mocking free functions PiperOrigin-RevId: 364943561
This commit is contained in:
		
				
					committed by
					
						
						Dino Radaković
					
				
			
			
				
	
			
			
			
						parent
						
							66836f0a90
						
					
				
				
					commit
					c0dd0817cf
				
			@@ -251,9 +251,9 @@ tests.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
### Mocking Free Functions
 | 
					### Mocking Free Functions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
It's possible to use gMock to mock a free function (i.e. a C-style function or a
 | 
					It is not possible to directly mock a free function (i.e. a C-style function or
 | 
				
			||||||
static method). You just need to rewrite your code to use an interface (abstract
 | 
					a static method). If you need to, you can rewrite your code to use an interface
 | 
				
			||||||
class).
 | 
					(abstract class).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Instead of calling a free function (say, `OpenFile`) directly, introduce an
 | 
					Instead of calling a free function (say, `OpenFile`) directly, introduce an
 | 
				
			||||||
interface for it and have a concrete subclass that calls the free function:
 | 
					interface for it and have a concrete subclass that calls the free function:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user