trompeloeil
trompeloeil copied to clipboard
Documentation: Clarify caveats of non-virtual function mocking
The mocking non-virtual functions documentation in the Cook Book should have a disclaimer that if you upcast the concrete mock instance to a base type, those mock methods cannot be called. If the base class interface is not virtual, then no virtual dispatch will take place. Worth making it clear to folks that you aren't changing vftable behavior in your library; e.g. this isn't magical.
Thoughts?
You are absolutely right. Trompeloeil works solely from the knowledge of the type, as it's visible at the site where you place expectations, so casting away from the known type will fail.
Feel free to issue a doc pull-request (directly to the master branch.)
@rollbear I am working on that now, I just wanted to confirm with you before I contribute something. What maximum line length do you require in your markdown files? I typically hard wrap at 100th column, but yours seems much shorter than that.
I don't have a hard limit, but I try not to go over 80. I'm sure you'll find counter examples, though.