You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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.
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.
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
The text was updated successfully, but these errors were encountered: