I have a GMOCK method like below:
MOCK_METHOD2(FnCall, bool(const Message* request, Message*& reply));
I have the below test code to set the values:
const Message* message = new MockMesage(9);
Message* reply = new MockMesage();
EXPECT_CALL(mMock, FnCall(::testing::_, ::testing::_)).WillOnce(::testing::SetArgReferee<0>(message));
But I get compilation errors:
C:/work/googletest/googlemock/include/gmock/gmock-more-actions.h:192:3: error: static assertion failed: SetArgReferee_must_be_used_with_a_reference_argument
GTEST_COMPILE_ASSERT_(internal::is_reference<argk_type>::value,
^
C:/work/googletest/googlemock/include/gmock/gmock-more-actions.h:194:27: error: assignment of read-only location 'std::get<0ull, {const Message*, Message*&}>((* & args))'
::testing::get<k>(args) = value;
error: no matching function for call to 'SetArgReferee(Message*&)'
How can we set mocked function arguments whose types are pointer and reference to a pointer ?
Aucun commentaire:
Enregistrer un commentaire