I have a factory that returns a smart pointer. Regardless of what smart pointer I use, I can\'t get Google Mock to mock the factory method.
The mock object is the im
I know this post was from a long time ago, so you've probably discovered the answer by now.
gmock previously did not support mock functions that returned any movable type, including smart pointers. However, in April 2017, gmock introduced a new Action modifier ByMove.
EXPECT_CALL(*foo_, Bar(_, )).WillOnce(Return(ByMove(some_move_only_object)));
where some_move_only_object can be e.g. a std::unique_ptr.
So yes, now gmock can mock a function that takes a smart pointer.