Open dmaclach opened 4 years ago
Excellent. I haven't done a very thorough pass but this looks exactly like the evolution I was asking for in #398.
As always thanks for looking at these Erik.
Found an issue where calling "isKindOfClass" on proxies was causing issues. Replaced with [OCMArg isUnretained]
which calls objc_getClass
instead.
So, I looked at this again in detail. I get the intent, but I don't understand the implementation. It's easier to comment directly in the code, which is what I'll do below.
I'll also comment on a few other points.
I hadn't realized that my last push had put this in a horribly mixed up state. I think it's much cleaner now.
Apologies but I have moved this change to OCMock 3.9 for now. The 3.8 release has taken much longer than I had hoped and there are a number of good changes in it already, which I'd like to get out soon. This PR still needs some work. The conflicts aren't too bad but there are a number of details (naming and otherwise) which I'd want to address before merging.
Allows marking an argument in a stub as being either 'unsafe' or 'unsafeunretained'. An unsafe object argument is retained by the stub, but not by invocations on the mock. An unsafe unretained object argument is not retained by the stub or by invocations on the mock.
This allows for mocking of methods that do not retain their arguments. This should simplify testing of methods that are called in dealloc, and give people a way out of other retain-loop problems.
Fix for #347 , #346 and may help with some of the discussion on #398