Closed APokorny closed 7 years ago
Before passing ownership to the final destination, capture the pointer to declare your expectations. I.e in your fixture:
std::unique_ptr<Type> thing{mocks.UniqueMock<Type>()}; Type* mock_thing{thing.get()};
.. in your test ..
MoreComplexThing obj{move(thing)}; mocks.ExpectCall(mock_thing, Type::beTypy);
Or write a 'tee' function along the lines of:
template <typename T> auto tee(T &* out, std::unique_ptr<T> && v) -> std::unique_ptr<T> { out = v.get(); return v; }
The new code requires unique_ptr to exist - disable with HM_NO_UNIQUE_PTR
Signed-off-by: Andreas Pokorny andreas.pokorny@siemens.com
Maybe it's a better idea to add this to the cpp11 branch?
Agreed .. also I should write some tests for that facility.
Before passing ownership to the final destination, capture the pointer to declare your expectations. I.e in your fixture:
.. in your test ..
Or write a 'tee' function along the lines of:
The new code requires unique_ptr to exist - disable with HM_NO_UNIQUE_PTR
Signed-off-by: Andreas Pokorny andreas.pokorny@siemens.com