You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classC
{
MAKE_MOCK1(foo, void(int));
voidbar(int);
};
TEST(a_test)
{
C obj;
REQUIRE_CALL(obj, foo(3)); // OKREQUIRE_CALL(obj, foo("")); // type mismatchREQUIRE_CALL(obj, bar(3)); // not a mockREQUIRE_CALL(obj, baz(3)); // no such function
}
All the above gives hideous compilation errors that should be possible to make more succinct.
However, all my attempts to use this when creating the expectation object have so far failed to produce any better/shorter compilation errors. It's a bit tricky... assistance highly desired.
The text was updated successfully, but these errors were encountered:
It gives a good message for what's wrong and where the error is, when the expectation does not match any signature, or is ambiguous, for the mock object. The message is a bit too verbose with many secondary errors following. It also fails to provide good information if the signature does match, but is not a mock.
Perhaps this is good enough?
I have written a better solution, based on the idea outlined initially, but unfortunately clang++ is the only compiler I've tried that it works for. Both g++ and VisualStudio 2015 fails miserably, and in completely different ways.
Some examples:
All the above gives hideous compilation errors that should be possible to make more succinct.
A promising technique is:
It could be used to test:
However, all my attempts to use this when creating the expectation object have so far failed to produce any better/shorter compilation errors. It's a bit tricky... assistance highly desired.
The text was updated successfully, but these errors were encountered: