Sha256: 1beac0a3c2fd1a9c642fdaa349ab80ad014f67ccf56a70b33da9bb03b25fec90
Contents?: true
Size: 1.04 KB
Versions: 8
Compression:
Stored size: 1.04 KB
Contents
#import "EXPMatchers+conformTo.h" #import "NSValue+Expecta.h" #import <objc/runtime.h> EXPMatcherImplementationBegin(conformTo, (Protocol *expected)) { BOOL actualIsNil = (actual == nil); BOOL expectedIsNil = (expected == nil); prerequisite(^BOOL{ return !(actualIsNil || expectedIsNil); }); match(^BOOL{ return [actual conformsToProtocol:expected]; }); failureMessageForTo(^NSString *{ if(actualIsNil) return @"the object is nil/null"; if(expectedIsNil) return @"the protocol is nil/null"; NSString *name = NSStringFromProtocol(expected); return [NSString stringWithFormat:@"expected: %@ to conform to %@", actual, name]; }); failureMessageForNotTo(^NSString *{ if(actualIsNil) return @"the object is nil/null"; if(expectedIsNil) return @"the protocol is nil/null"; NSString *name = NSStringFromProtocol(expected); return [NSString stringWithFormat:@"expected: %@ not to conform to %@", actual, name]; }); } EXPMatcherImplementationEnd
Version data entries
8 entries across 8 versions & 2 rubygems