Skip to content
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

Selectively Ignoring Object Arguments #347

Open
alanterranova opened this issue Oct 12, 2017 · 2 comments
Open

Selectively Ignoring Object Arguments #347

alanterranova opened this issue Oct 12, 2017 · 2 comments

Comments

@alanterranova
Copy link

Hi Erik,

Now that OCMock retains arguments passed to mocks, I’m unable to test dealloc logic for objects whose references are retained by mocks.

Is it possible to enable "legacy" behavior on a per-mock basis, such as adding a method on OCMockObject that skips retention ("noRetainObjectArgs") or releases arguments ("releaseObjectArgs")? Happy to contribute if either seems reasonable.

Thanks,

Alan

@erikdoe
Copy link
Owner

erikdoe commented Oct 14, 2017

I understand the issue. However, this seems to be quite a niche use case and, at the same time, this would make some already complex logic inside OCMock even more complex and it would require changes to the API.

For your cases could you not just send a release to the objects in question from your test code? I know it feels "asymmetric" but it's also pragmatic.

@alanterranova
Copy link
Author

In some cases I can nil the mocks in question, but not mocks that need to be verified. Explicitly releasing the objects under test is disallowed in ARC. That's where having the ability to release (or simply not retain) arguments would be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants