-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support unique ptr #82
base: cpp11
Are you sure you want to change the base?
Conversation
This allows creating default unique_ptr<T> mock objects. Signed-off-by: Andreas Pokorny <[email protected]>
This assumes that the destructor of "base" is actually called. Signed-off-by: Andreas Pokorny <[email protected]>
Solves the common case of capturing an object to formulate expectations while forwarding exclusive ownership to the class under test Signed-off-by: Andreas Pokorny <[email protected]>
Signed-off-by: Andreas Pokorny <[email protected]>
Is there anything missing here? |
Only time for me to review your change. I'll find some time the next two days. |
@dascandy Are you planning to merge to cpp 11 branch. |
@APokorny Time got lost here. From what I can tell it's similar to adding an ExpectDestructor to a regular mock & returning a unique_ptr directly? That would be a much smaller delta to the existing code base & not require a new subclass... |
[Issue/Feature Description] Mocking of unique_ptr is currently not supported in HippoMocks. [Resolution] Cherry-pick changes from dascandy#82 which add support for unique_ptr.
[Issue/Feature Description] Mocking of unique_ptr is currently not supported in HippoMocks. [Resolution] Cherry-pick changes from dascandy#82 which add support for unique_ptr.
This adds support for mock objects controlled by unique_ptr. In this proposal the mock repository is not the owner of the mock object - it just assists in construction. The verification of expectations thus happens when the mock object is destroyed.
Use the new UniqueMock function (or UniqueMock(Deleter d)) to construct a mock object within a unique_ptr. For example in your test you can write: