Created
June 22, 2013 14:12
-
-
Save JoshOldenburg/5841014 to your computer and use it in GitHub Desktop.
JOAssertEqualsString for SenTestKit is like STAssertEquals but for NSString's.
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
#define JOAssertEqualsString(a1, a2, description, ...) \ | |
do { \ | |
@try {\ | |
if (![a1 isKindOfClass:[NSString class]] || ![a2 isKindOfClass:[NSString class]]) { \ | |
[self failWithException:([NSException failureInFile:[NSString stringWithUTF8String:__FILE__] \ | |
atLine:__LINE__ \ | |
withDescription:@"%@", [@"Type mismatch -- " stringByAppendingString:STComposeString(description, ##__VA_ARGS__)]])]; \ | |
} \ | |
else { \ | |
if (![a1 isEqualToString:a2]) { \ | |
[self failWithException:([NSException failureInEqualityBetweenObject:a1 \ | |
andObject:a2 \ | |
inFile:[NSString stringWithUTF8String:__FILE__] \ | |
atLine:__LINE__ \ | |
withDescription:@" -- %@", STComposeString(description, ##__VA_ARGS__)])]; \ | |
} \ | |
} \ | |
} \ | |
@catch (id anException) {\ | |
[self failWithException:([NSException \ | |
failureInRaise:[NSString stringWithFormat:@"(%s) == (%s)", #a1, #a2] \ | |
exception:anException \ | |
inFile:[NSString stringWithUTF8String:__FILE__] \ | |
atLine:__LINE__ \ | |
withDescription:@"%@", STComposeString(description, ##__VA_ARGS__)])]; \ | |
}\ | |
} while(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment