Open reddwarf69 opened 6 years ago
I'm running into this, too.
Given an interface like this:
struct rvtest
{
virtual ~rvtest() = default;
virtual std::unique_ptr<int> ui() const = 0;
};
Adding the following to a test causes a compile error, where the code wants to call the copy constructor of unique_ptr:
Mock<rvtest> testDouble;
When(Method(testDouble, ui)).AlwaysReturn(std::unique_ptr<int>{});
(AlwaysReturn()
relies on AlwaysDo
)
Any thoughts on a possible resolution? This is a pretty common use case.
I have to stub a function that returns a future. So I create a promise, get a future from it and pass this future to a lambda that returns it. The lambda itself is movable, but not copyable, because the future it contains is the same. This should not be an issue, but when passing (a r-value reference to) the lambda to Do()/AlwaysDo() FakeIt tries to copy the lambda, which fails.