Sha256: 21072069f022f359c723af53d2faa6705e1ba4b49cee22053dd8e2b82b07a31d
Contents?: true
Size: 1.62 KB
Versions: 8
Compression:
Stored size: 1.62 KB
Contents
#import "EXPMatchers+raiseWithReason.h" #import "EXPDefines.h" EXPMatcherImplementationBegin(raiseWithReason, (NSString *expectedExceptionName, NSString *expectedReason)) { __block NSException *exceptionCaught = nil; match(^BOOL{ BOOL expectedExceptionCaught = NO; @try { ((EXPBasicBlock)actual)(); } @catch(NSException *e) { exceptionCaught = e; expectedExceptionCaught = (((expectedExceptionName == nil) || [[exceptionCaught name] isEqualToString:expectedExceptionName]) && ((expectedReason == nil) || ([[exceptionCaught reason] isEqualToString:expectedReason]))); } return expectedExceptionCaught; }); failureMessageForTo(^NSString *{ return [NSString stringWithFormat:@"expected: %@ (%@), got: %@ (%@)", expectedExceptionName ?: @"any exception", expectedReason ?: @"any reason", exceptionCaught ? [exceptionCaught name] : @"no exception", exceptionCaught ? [exceptionCaught reason] : @""]; }); failureMessageForNotTo(^NSString *{ return [NSString stringWithFormat:@"expected: %@ (%@), got: %@ (%@)", expectedExceptionName ? [NSString stringWithFormat:@"not %@", expectedExceptionName] : @"no exception", expectedReason ? [NSString stringWithFormat:@"not '%@'", expectedReason] : @"no reason", exceptionCaught ? [exceptionCaught name] : @"no exception", exceptionCaught ? [exceptionCaught reason] : @"no reason"]; }); } EXPMatcherImplementationEnd
Version data entries
8 entries across 8 versions & 2 rubygems