Closed fgr-17 closed 1 year ago
Hello!
I'm using FakeIt lib with Catch2. I'm having some issues when I try to verify global mocked objects methods execution.
First, a working example:
class SomeInterface { void fun(void) {} }; TEST_CASE("mock test", "[test]") { Mock<SomeInterface> mock; Fake(Method(mock, fun)); SomeInterface&i=mock.get(); i.toggle(); Verify((Method(mock, toggle)).AtLeastOnce(); }
But if the object assigned by mock.get() is global, the compilation builds OK, but the verify test fail.
How can I overcome this?
Can you provide exactly the code that fails ? Looks like you may be copying the mock instead of using a reference to it but I'm not sure.
I'll close it as there was no answer for one year.
Hello!
I'm using FakeIt lib with Catch2. I'm having some issues when I try to verify global mocked objects methods execution.
First, a working example:
But if the object assigned by mock.get() is global, the compilation builds OK, but the verify test fail.
How can I overcome this?