calvert1991/googlemock

Automatically generate mock pure virtual functions

Closed this issue · 4 comments

I have a class with 30 pure virtual functions that I'm trying to create a 
mock for. In the mock subclass, I have to define 30 MOCK_METHODs, even 
though only a few will be called in my test, because otherwise the compiler 
says that the subclass is abstract and not instantiable. Can we have gmock 
automatically define the other functions? These implicitly mocked functions 
can do anything, including aborting the process, because they won't be 
called, anyway.

Original issue reported on code.google.com by k...@google.com on 17 Mar 2010 at 4:32

Please use the mailing list for questions.  Thanks.

Original comment by w...@google.com on 17 Mar 2010 at 4:41

  • Changed state: WontFix
This was not a question but a a feature request. Sorry for not setting the type 
correctly.

Original comment by k...@google.com on 17 Mar 2010 at 4:57

Take a look at scripts/generator/gmock_gen.py.

Original comment by vl...@google.com on 17 Mar 2010 at 5:15

Thanks!

Original comment by k...@google.com on 17 Mar 2010 at 5:30