I am using gmock in my project and I meet a problem to set a custom reference variable for a mock function. I have used SetArgPointee and Return ,but the function can only get the return value.
my mock function is
MOCK_METHOD1_WITH_CALLTYPE(__stdcall, get_length, HRESULT(long *p));my TEST is like this:
long pl = 10;
EXPECT_CALL(*ihtmlelemc, get_length(_)).WillOnce(DoAll(SetArgPointee<0>(pl), Return(S_OK)));and my test function is
long len = 0;
HRESULT hr;
hr = pObjCollect->get_length(&len);
if (hr != S_OK || len == 0)
{
return E_NOINTERFACE;
}when I run the test only found that thr hr is S_OK, len is still 0, the len can't get the value,anyone can tell me why and how to get the value,thanks.
--
---
You received this message because you are subscribed to the Google Groups "Google C++ Mocking Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to googlemock+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/googlemock/d6aba138-f995-4b73-9fef-227158cdbc39%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
First double check that that mock method is being called at all.It could be that there's something else going on or some typo.Need to narrow down the trouble.I don't for example see the definition of pObjCollect in your sample code.
--I am using gmock in my project and I meet a problem to set a custom reference variable for a mock function. I have used SetArgPointee and Return ,but the function can only get the return value.
my mock function is
MOCK_METHOD1_WITH_CALLTYPE(__stdcall, get_length, HRESULT(long *p));my TEST is like this:
long pl = 10; EXPECT_CALL(*ihtmlelemc, get_length(_)).WillOnce(DoAll(SetArgPointee<0>(pl), Return(S_OK)));and my test function is
long len = 0; HRESULT hr; hr = pObjCollect->get_length(&len); if (hr != S_OK || len == 0) { return E_NOINTERFACE; }when I run the test only found that thr hr is S_OK, len is still 0, the len can't get the value,anyone can tell me why and how to get the value,thanks.
---
You received this message because you are subscribed to the Google Groups "Google C++ Mocking Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to googlemock+unsubscribe@googlegroups.com.