eranpeer / FakeIt

C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.
MIT License
1.24k stars 170 forks source link

Argument matching with custom classes #58

Closed rafamanzo closed 7 years ago

rafamanzo commented 8 years ago

First congratulations for the nice work with this lib! I'm coming from GMock and loving it!

But, I'm having some trouble with code that I don't see wgy it should no work. So, is the following supposed the work? https://gist.github.com/rafamanzo/196e2d373f2e26ea9fe3

Because I'm getting the following:

unknown location(0): fatal error: in "test_call": std::string: Unexpected method invocation: friend_mock.call(?)
  Could not find Any recorded behavior to support this method call.
/home/manzo/workspace/test/test.cpp(68): last checkpoint: "test_call" entry.

I'm sorry if it is a silly mistake, but I'm on it for hours in a much larger code. After trying everyting I've written this smaller example above to reproduce my issue.

If its not a mistake made by me, I'm afraid it may somehow be related to my environment versions:

Boost 1.60.0 GCC 5.3.0 glibc 2.22 (Arch Linux)

Thanks in advance and I appreciate any response.

whschultz commented 8 years ago

In test.cpp, on lines 73 and 74, try adding ".AlwaysReturn()" at the end of the chain.