I'm trying to do some sleep inside .WillOnce before invoking FuncHelper. So I need something similar to the following:
EXPECT_CALL(*_mock, Func(_,_,_)).Times(1)
.WillOnce(DoAll(InvokeWithoutArgs(sleep(TimeToSleep)),
Invoke(_mock, &M_MyMock::FuncHelper)));
Is it possible to call sleep() with an arg inside .DoAll? C++98 is preferrable.
UPD:
The solution is based on @Smeeheey answer and uses C++98.
template <int N> void Sleep ()
{
sleep(N);
}
...
EXPECT_CALL(*_mock, Func(_,_,_)).Times(1)
.WillOnce(DoAll(InvokeWithoutArgs(Sleep<TimeToSleep>),
Invoke(_mock, &M_MyMock::FuncHelper)));