Search code examples
objective-cocmock

OCMock Argument Match on Double Pointer


For a selector like this:

-(void) callFoo:(NSError**)error;

How can I get an expectation like the below to work? ARC is not liking this kind of expectation, and I don't want to disable ARC for the entire unit test file!

[[mockObject expect] callFoo:[OCMArg anyPointer]];

Solution

  • Often times, there's no other way than to write a wrapper selector that OCMock likes when OCMock has a problem with a certain selector. Ugly hack, but it gets around it, let's you use ARC, and takes less than a minute to setup.

    I find myself using it all the time with OCMock, unfortunately.