This says you expect the const string& version of log() to be called.
> but I get the following error.
>
> GMOCK WARNING:
> Uninteresting mock function call - returning directly.
> Function call: log(6, 0x8061f90 pointing to "subscribers file not
> found, creating new file")
This says that the const char* version is called actually. The
"pointing to" is the give-away: it means the argument is a pointer.
> Stack trace:
> events_test.cpp:55: Failure
> Actual function call count doesn't match EXPECT_CALL(*tMockDb, log(_,
> A<const std::string&>()))...
> Expected: to be called once
> Actual: never called - unsatisfied and active
This says that the const string& version is never called, which is the truth.
> I've tried several variations with Const() and ByRef(), but I can't
> figure this one out. Can anyone point me in the right direction?
It's a design smell to have overloaded virtual functions that are hard
to distinguish from the call site. You probably want to make one of
them non-virtual and implement it in terms of the virtual one.
--
Zhanyong
That makes sense. I was so wrapped up assuming my matcher was wrong
that I overlooked the obvious.
> It's a design smell to have overloaded virtual functions that are hard
> to distinguish from the call site. You probably want to make one of
> them non-virtual and implement it in terms of the virtual one.
In the impl class I had the C string version calling the other, but it
makes more sense to do as you suggest.
Thank you much for your help and suggestions.
Steve