Hello all, I'm having a little bit of problem using WithArg and SetArgReferee together
class MyMock {
public:
MOCK_METHOD2(DoIt, void(int p0, int& p1));
};
And I want to make calls to "DoIt" assign: 'p1 = p0'
I looked at the documentation and found the two functions WithArg and SetArgReferee, so I tried:
void test()
{
using namespace testing;
MyMock mock;
ON_CALL(mock, DoIt(_, _))
.WillByDefault(WithArg<0>(SetArgReferee<1>));
}
But I wasnt successfull, the error message I get is this:
1>d:\framework_app\am_tests\helpers\doccadmoldesbuilder.cpp(76) : error C2780: 'testing::SetArgRefereeActionP<k,value_type> testing::SetArgReferee(value_type)' : expects 1 arguments - 1 provided
1> d:\framework_app\third_part\gmock-1.4.0\include\gmock\gmock-more-actions.h(144) : see declaration of 'testing::SetArgReferee'
1>d:\framework_app\am_tests\helpers\doccadmoldesbuilder.cpp(76) : error C2784: 'testing::internal::WithArgsAction<InnerAction,k1> testing::WithArg(const InnerAction &)' : could not deduce template argument for 'overloaded function type' from 'overloaded function type'
1> d:\framework_app\third_part\gmock-1.4.0\include\gmock\gmock-more-actions.h(121) : see declaration of 'testing::WithArg'
Since SetArgReferee is an Action, I thought I would be able to do this kind of binding on the args. Where am I missing the point here?
Thanks for any help
--
Edison Gustavo Muenz