Closed scgroot closed 2 years ago
Given to following code:
struct Test { virtual ~Test() {} virtual void blaat(std::shared_ptr<int> ptr) = 0; }; struct TestImpl { virtual ~TestImpl() {} virtual void blaat(std::shared_ptr<int>) {} }; auto ptr = std::make_shared<int>(1); // Using a regular Mock Mock<Test> test; When(Method(test, blaat)).AlwaysReturn(); test.get().blaat(ptr); Verify(Method(test, blaat).Using(ptr)).Exactly(1); // Using spy TestImpl impl; Mock<TestImpl> spy(impl); Spy(Method(spy, blaat)); spy.get().blaat(ptr); Verify(Method(spy, blaat).Using(ptr)).Exactly(1);
...then the second one does not work. The ptr that is matched against Using somehow becomes 0:
Verify( spy.blaat(0x558c07f04920) ) 1: with message: 1: /home/user/file.cc: 1: 64: Verification error 1: Expected pattern: spy.blaat(0x558c07f04920) 1: Expected matches: exactly 1 1: Actual matches : 0 Errors while running CTest 1: Actual sequence : total of 1 actual invocations: 1: spy.blaat(0)
When creating a 'normal' Mock, it works fine. I'm using the most recent catch2version.
Should be fixed with #272.
Given to following code:
...then the second one does not work. The ptr that is matched against Using somehow becomes 0:
When creating a 'normal' Mock, it works fine. I'm using the most recent catch2version.