jonreid/OCMockito — pull request #48 by cesteban (2013-11-24 15:16:06+00:00)
Title: Add support for struct arguments

Problem:
- Sending a message to a mock with an struct argument produces an error: "-- Unhandled type: {CGRect={CGPoint=ff}{CGSize=ff}}"

Fix:
- Detect struct arg in TKArrayArgumentsForInvocation.
- Allocate memory to store struct. Important: initialize with zeros to discard alignment padding.
- Wrap struct in NSData and store in the array.
- Free allocated memory. Should be safe as long as dataWithBytes:length: copies the bytes (as explained in https://developer.apple.com/library/mac/documentation/cocoa/Conceptual/BinaryData/Tasks/WorkingBinaryData.html).

Provided tests:
- Verify tests that show how structs can be passed as args to mocks.
- Stub tests that show how structs can be used for stubbing.
- Note that equality check compares the bytes inside the structs.

Possible improvements:
- Method dataWithBytesNoCopy:length: could be used instead of dataWithBytes:length:, that should remove the need for freeing arg pointer.