GMock testing destructor calls -
I've read the section in the gmock cookbook, but I'm not getting any fate to work on it. My code is almost exactly what the doctor says:
class mokfu: public fu {public: mokfu () {} mockflu () mokfu, void (); Virtual ~ mocfu () {destroyMockFoo (); }}; TEST_F (Districtist, Feffell) {Mockfu * Fu = New Mockfu (); EXPECT_CALL (* Foo, BlockMockfu ()); } But when I run the code, there is no error in the test. I get an error at the end of the test output about the leak object:
< Code> DestructorTest.cpp: 149: Error: This fake object (used in test district test.shouldFail) should be deleted, but never know its address @ 0x81787 9 Error: 1 leaked duplicate object found on program exit < / P>
you have something Also, the problem here is that the problem here is that fake expectations have been verified in the destruction of counterfeit goods, so if the destroyer is never asked then the expectations are never verified. This is what is happening in your example.
The easy way to go around this is to clearly verify the expectations on the fake:
Fake: Verification and Claire Expectation (FU);This will give you the behavior you are looking for.
Comments
Post a Comment