diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2013-07-22 20:30:08 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2013-07-22 20:30:08 +0000 |
commit | 135be32fd14474885986da0709a4e9e2b77841d5 (patch) | |
tree | e91e027c20db0be02e82f4c12070341e1d850875 /UnitTesting | |
parent | 8623a7876fe21852e9ce3ad031ac572e563a3462 (diff) |
Fix up some assertions so that they don't run into issues with format strings
not being constants.
DELTA=32 (18 added, 0 deleted, 14 changed)
Diffstat (limited to 'UnitTesting')
-rw-r--r-- | UnitTesting/GTMSenTestCase.h | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/UnitTesting/GTMSenTestCase.h b/UnitTesting/GTMSenTestCase.h index 744550f..023a64a 100644 --- a/UnitTesting/GTMSenTestCase.h +++ b/UnitTesting/GTMSenTestCase.h @@ -873,20 +873,26 @@ do { \ continue; \ } \ @catch (id anException) { \ - NSString *_descrip = STComposeString(@"(Expected exception: %@) %@", NSStringFromClass([specificException class]), description); \ + NSString *_descrip = STComposeString( \ + @"(Expected exception: %@) ", \ + NSStringFromClass([specificException class])); \ + _descrip = [_descrip stringByAppendingFormat:description, ##__VA_ARGS__]; \ [self failWithException:[NSException failureInRaise:[NSString stringWithUTF8String:#expr] \ exception:anException \ inFile:[NSString stringWithUTF8String:__FILE__] \ atLine:__LINE__ \ - withDescription:@"%@", STComposeString(_descrip, ##__VA_ARGS__)]]; \ - continue; \ + withDescription:@"%@", _descrip]]; \ + continue; \ } \ - NSString *_descrip = STComposeString(@"(Expected exception: %@) %@", NSStringFromClass([specificException class]), description); \ + NSString *_descrip = STComposeString( \ + @"(Expected exception: %@) ", \ + NSStringFromClass([specificException class])); \ + _descrip = [_descrip stringByAppendingFormat:description, ##__VA_ARGS__]; \ [self failWithException:[NSException failureInRaise:[NSString stringWithUTF8String:#expr] \ exception:nil \ inFile:[NSString stringWithUTF8String:__FILE__] \ atLine:__LINE__ \ - withDescription:@"%@", STComposeString(_descrip, ##__VA_ARGS__)]]; \ + withDescription:@"%@", _descrip]]; \ } while (0) @@ -909,32 +915,41 @@ do { \ } \ @catch (specificException *anException) { \ if ([aName isEqualToString:[anException name]]) continue; \ - NSString *_descrip = STComposeString(@"(Expected exception: %@ (name: %@)) %@", NSStringFromClass([specificException class]), aName, description); \ + NSString *_descrip = STComposeString( \ + @"(Expected exception: %@ (name: %@)) ", \ + NSStringFromClass([specificException class]), aName); \ + _descrip = [_descrip stringByAppendingFormat:description, ##__VA_ARGS__]; \ [self failWithException: \ [NSException failureInRaise:[NSString stringWithUTF8String:#expr] \ exception:anException \ inFile:[NSString stringWithUTF8String:__FILE__] \ atLine:__LINE__ \ - withDescription:@"%@", STComposeString(_descrip, ##__VA_ARGS__)]]; \ + withDescription:@"%@", _descrip]]; \ continue; \ } \ @catch (id anException) { \ - NSString *_descrip = STComposeString(@"(Expected exception: %@) %@", NSStringFromClass([specificException class]), description); \ + NSString *_descrip = STComposeString( \ + @"(Expected exception: %@ (name: %@)) ", \ + NSStringFromClass([specificException class]), aName); \ + _descrip = [_descrip stringByAppendingFormat:description, ##__VA_ARGS__]; \ [self failWithException: \ [NSException failureInRaise:[NSString stringWithUTF8String:#expr] \ exception:anException \ inFile:[NSString stringWithUTF8String:__FILE__] \ atLine:__LINE__ \ - withDescription:@"%@", STComposeString(_descrip, ##__VA_ARGS__)]]; \ + withDescription:@"%@", _descrip]]; \ continue; \ } \ - NSString *_descrip = STComposeString(@"(Expected exception: %@) %@", NSStringFromClass([specificException class]), description); \ + NSString *_descrip = STComposeString( \ + @"(Expected exception: %@ (name: %@)) ", \ + NSStringFromClass([specificException class]), aName); \ + _descrip = [_descrip stringByAppendingFormat:description, ##__VA_ARGS__]; \ [self failWithException: \ [NSException failureInRaise:[NSString stringWithUTF8String:#expr] \ exception:nil \ inFile:[NSString stringWithUTF8String:__FILE__] \ atLine:__LINE__ \ - withDescription:@"%@", STComposeString(_descrip, ##__VA_ARGS__)]]; \ + withDescription:@"%@", _descrip]]; \ } while (0) @@ -1004,13 +1019,16 @@ do { \ } \ @catch (specificException *anException) { \ if ([aName isEqualToString:[anException name]]) { \ - NSString *_descrip = STComposeString(@"(Expected exception: %@ (name: %@)) %@", NSStringFromClass([specificException class]), aName, description); \ + NSString *_descrip = STComposeString( \ + @"(Expected exception: %@ (name: %@)) ", \ + NSStringFromClass([specificException class]), aName); \ + _descrip = [_descrip stringByAppendingFormat:description, ##__VA_ARGS__]; \ [self failWithException: \ [NSException failureInRaise:[NSString stringWithUTF8String:#expr] \ exception:anException \ inFile:[NSString stringWithUTF8String:__FILE__] \ atLine:__LINE__ \ - withDescription:@"%@", STComposeString(_descrip, ##__VA_ARGS__)]]; \ + withDescription:@"%@", _descrip]]; \ } \ continue; \ } \ |