ocmock icon indicating copy to clipboard operation
ocmock copied to clipboard

OCMock Argument capture support

Open JARinteractive opened this issue 12 years ago • 2 comments

This allows OCMArg to capture objects or blocks passed to a stubbed method

JARinteractive avatar Oct 25 '13 17:10 JARinteractive

Thank you, this is an amazing addition that really helps make writing tests easier. This should be part of the regular distribution.

zacwest avatar Feb 13 '14 19:02 zacwest

Is this much different than something like:

__block id var;
[[mock expect] someMethodWithArg:[OCMArg checkWithBlock:BOOL^(id param){ var = param; return YES; }];

?

Also, not sure how the "void *" will work with ARC. NSInvocations are dangerous that way... you have to declare the local variables __unsafe_unretained when pulling values out. This might be a similar situation (though the checkWithBlock: approach does not have that issue).

carllindberg avatar Feb 13 '14 23:02 carllindberg