eranpeer / FakeIt

C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.
MIT License
1.24k stars 170 forks source link

Request: Easier verification, even automatic verification in a strict mode #74

Open jamespharvey20 opened 7 years ago

jamespharvey20 commented 7 years ago

Would it possible to allow one statement that merges When() and Verify() calls? Either like Verify(When()) or When().Verify()? (Perhaps implemented by an automatically created hidden object's destructor, if that helped, so the verifications automatically happened when the current scope closed.) It would be especially nice to not have the same .Matching() in two spots, on both When() and Verify().

Would it be possible to have a strict mode, perhaps as a flag to Mock<> or Mock<>.get() that would assume any When() expected .Exactly(1), and also at the end VerifyNoOtherInvocations()? I realize others might not like this, but I'd love to be able to just use the When() statements to create my exact sequence of invocations, without even having to add any extra syntax to the When() calls.

djleach-belcan commented 6 years ago

Coming from Google Mock I was hoping for something exactly like this. Attempts to recreate this behavior myself are not going well :/