How to add failure message to Google Test EXPECT_CALL

Viewed 130

Is there a way in google test to add a message to a mock expectation in case of a failure?

Similar to other expectations or assertions it'd be nice if I could do...

EXPECT_CALL(mock, foo()).Times(1) << "Mock did not call foo!";

However, this isn't supported. Is there a way to add this verbose information or custom information on a mock failure?

1 Answers

There is no a simple way to do it. You can specialize the template class FunctionMocker for R() like template<> FunctionMocker<R>, R is the type returned by foo.

Related