Hi Vlad,
Yes, this helps - I tried the first option (with char[N2]) and it
worked. I added the copying of value_.c_str() + 1 characters (instead
of value_.c_str()) to get the string terminated with \0.
However, looking at your code sample (still, the first option) I don't
get how N2 automatically gets the value of literal string length, when
used in a test. This may be a silly question, but: how does this
happen?
SetArgPointee<k>(x) is supposed to do:
*arg_k = x;
where arg_k is the k-th argument of the mock function.
Apparently this is *not* what you want, which is:
strcpy(arg_k, x);
This is a different semantics, and thus should be handled by a
different construct. Instead of trying to abuse SetArgPointee<k>(x)
to do this, you should define a separate action for it.
--
Zhanyong
No.
> The issue says that SetArgPointee<k> cannot take string
> literals, like SetArgPointee<0>("hello") and that it should handle
> this.
That's true. But it doesn't say that SetArgPointee<0>("hello") should
do a strcpy(). ;-)
> Now what you wrote seems to be contrary the essence of the issue
> (suggestion to define a different action). Am I missing something?
SetArgPointee<0>("hello") is supposed to do
*arg0 = "hello";
(for example, arg0 may be a string* or a const char**)
> Piotr
>
>>
>> SetArgPointee<k>(x) is supposed to do:
>>
>> *arg_k = x;
>>
>> where arg_k is the k-th argument of the mock function.
>>
>> Apparently this is *not* what you want, which is:
>>
>> strcpy(arg_k, x);
>>
>> This is a different semantics, and thus should be handled by a
>> different construct. Instead of trying to abuse SetArgPointee<k>(x)
>> to do this, you should define a separate action for it.
>>
>> Zhanyong
>
--
Zhanyong