Created
November 19, 2013 18:42
-
-
Save SlaunchaMan/7550294 to your computer and use it in GitHub Desktop.
Checking if an Objective-C class implements required protocol methods using Kiwi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it(@"should implement the required methods in the protocol", ^{ | |
unsigned int methodCount; | |
struct objc_method_description *methodList = | |
protocol_copyMethodDescriptionList(NSProtocolFromString(@"ProtocolName"), | |
YES, | |
YES, | |
&methodCount); | |
for (unsigned int i = 0; i < methodCount; i++) { | |
SEL methodName = methodList[i].name; | |
[[objectBeingTested should] respondToSelector:methodName]; | |
} | |
if (methodList != NULL) { | |
free(methodList); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment