writing custom Matchers

1,048 views
Skip to first unread message

Venu

unread,
Aug 3, 2010, 1:33:57 PM8/3/10
to Google C++ Mocking Framework

Hi,

Can we call a Matcher from another matcher? i am trying to validate
the protobuf message passed as a parameter to the mock method. the
protobuf message which contains another proto buf message. i want to
have separate matchers for these two protobuf messages. but like to
call the matcher for second protobuf message from the first protobuf
message matcher.

is it possible to do like that?

Thanks,
Venu

Zhanyong Wan (λx.x x)

unread,
Aug 3, 2010, 1:38:37 PM8/3/10
to Venu, Google C++ Mocking Framework

Venu

unread,
Aug 3, 2010, 2:57:04 PM8/3/10
to Google C++ Mocking Framework

Hi Zhanyong,

could you point me to an example? am a bit confused of how to use
those predicates inside a custom matcher (MATCHER*)


Thanks,
Venu

On Aug 3, 1:38 pm, Zhanyong Wan (λx.x x) <w...@google.com> wrote:
> On Tue, Aug 3, 2010 at 10:33 AM, Venu <dvgo...@gmail.com> wrote:
>
> > Hi,
>
> > Can we call a Matcher from another matcher? i am trying to validate
> > the protobuf message passed as a parameter to the mock method. the
> > protobuf message which contains another proto buf message. i want to
> > have separate matchers for these two protobuf messages. but like to
> > call the matcher for second protobuf message from the first protobuf
> > message matcher.
>
> > is it possible to do like that?
>
> http://code.google.com/p/googlemock/wiki/CheatSheet#Matchers_as_Predi...
>
>
>
> > Thanks,
> > Venu
>
> --
> Zhanyong

Zhanyong Wan (λx.x x)

unread,
Aug 3, 2010, 3:03:56 PM8/3/10
to Venu, Google C++ Mocking Framework
On Tue, Aug 3, 2010 at 11:57 AM, Venu <dvg...@gmail.com> wrote:
>
> Hi Zhanyong,
>
> could you point me to an example? am a bit confused of how to use
> those predicates inside a custom matcher (MATCHER*)

You can search for examples in gmock's own tests (under the test/ directory).

>
>
> Thanks,
> Venu
>
> On Aug 3, 1:38 pm, Zhanyong Wan (λx.x x) <w...@google.com> wrote:
>> On Tue, Aug 3, 2010 at 10:33 AM, Venu <dvgo...@gmail.com> wrote:
>>
>> > Hi,
>>
>> > Can we call a Matcher from another matcher? i am trying to validate
>> > the protobuf message passed as a parameter to the mock method. the
>> > protobuf message which contains another proto buf message. i want to
>> > have separate matchers for these two protobuf messages. but like to
>> > call the matcher for second protobuf message from the first protobuf
>> > message matcher.
>>
>> > is it possible to do like that?
>>
>> http://code.google.com/p/googlemock/wiki/CheatSheet#Matchers_as_Predi...
>>
>>
>>
>> > Thanks,
>> > Venu
>>
>> --
>> Zhanyong
>

--
Zhanyong

Reply all
Reply to author
Forward
0 new messages