turtle icon indicating copy to clipboard operation
turtle copied to clipboard

No support for calling an overridden base-class method

Open jonesmz opened this issue 5 years ago • 2 comments

When using turtle mock to mock objects that have virtual functions, frequently those virtual functions are intended to have their base implementation called.

Turtle mock has no mechanism to do that.

Ideally, the syntax for declaring a mock member function can be extended to signal that the base implementation should be called.

MOCK_CONST_METHOD(..., callBaseImpl);

jonesmz avatar Jan 07 '21 00:01 jonesmz

Hi,

Can’t you set it up using a calls action?

See:

  • http://turtle.sourceforge.net/turtle/reference.html#turtle.reference.expectation.actions
  • https://www.oreilly.com/library/view/c-cookbook/0596007612/ch08s16.html

mat007 avatar Jan 07 '21 09:01 mat007

Yes, that's what I'm doing now.

But when you have several hundred instances of a MOCK_EXPECT() on a function that needs to call the base class's function, it gets very tedious to have to use .calls() for each place.

I know that you're not actively working on this library anymore, but if someone does a drive-by contribution to add support for this that would be nice.

jonesmz avatar Jan 08 '21 04:01 jonesmz