diff options
Diffstat (limited to 'UnitTesting')
-rw-r--r-- | UnitTesting/GTMAppKit+UnitTesting.m | 8 | ||||
-rw-r--r-- | UnitTesting/GTMAppKitUnitTestingUtilities.m | 5 | ||||
-rw-r--r-- | UnitTesting/GTMNSObject+UnitTesting.m | 9 | ||||
-rw-r--r-- | UnitTesting/GTMSenTestCase.h | 16 | ||||
-rw-r--r-- | UnitTesting/GTMSenTestCase.m | 2 |
5 files changed, 23 insertions, 17 deletions
diff --git a/UnitTesting/GTMAppKit+UnitTesting.m b/UnitTesting/GTMAppKit+UnitTesting.m index 8bca7ca..02e0e30 100644 --- a/UnitTesting/GTMAppKit+UnitTesting.m +++ b/UnitTesting/GTMAppKit+UnitTesting.m @@ -321,7 +321,8 @@ GTM_METHOD_CHECK(NSObject, gtm_unitTestEncodeState:); NSToolbarItem *item = nil; NSUInteger i = 0; GTM_FOREACH_OBJECT(item, [self items]) { - NSString *key = [NSString stringWithFormat:@"ToolbarItem %d", i]; + NSString *key + = [NSString stringWithFormat:@"ToolbarItem %lu", (unsigned long)i]; [inCoder encodeObject:item forKey:key]; i = i + 1; } @@ -417,7 +418,7 @@ GTM_METHOD_CHECK(NSObject, gtm_unitTestEncodeState:); ENCODE_NSINTEGER(inCoder, segmentCount, @"SegmentCount"); for (NSInteger i = 0; i < segmentCount; ++i) { - NSString *key = [NSString stringWithFormat:@"Segment %d", i]; + NSString *key = [NSString stringWithFormat:@"Segment %ld", (long)i]; [inCoder encodeObject:[self labelForSegment:i] forKey:key]; } } @@ -449,7 +450,8 @@ GTM_METHOD_CHECK(NSObject, gtm_unitTestEncodeState:); for (NSUInteger i = 0; i < [objectValues count]; ++i) { id value = [objectValues objectAtIndex:i]; if ([value isKindOfClass:[NSString class]]) { - NSString *key = [NSString stringWithFormat:@"ComboBoxObjectValue %u", i]; + NSString *key = [NSString stringWithFormat:@"ComboBoxObjectValue %lu", + (unsigned long)i]; [inCoder encodeObject:value forKey:key]; } } diff --git a/UnitTesting/GTMAppKitUnitTestingUtilities.m b/UnitTesting/GTMAppKitUnitTestingUtilities.m index ff9442e..6f51410 100644 --- a/UnitTesting/GTMAppKitUnitTestingUtilities.m +++ b/UnitTesting/GTMAppKitUnitTestingUtilities.m @@ -175,8 +175,9 @@ void GTMRestoreColorProfile(void) { // COV_NF_START // No way to force this case in a unittest. _GTMDevLog(@"Failed to restore previous color profile! " - "You may need to open System Preferences : Displays : Color " - "and manually restore your color settings. (Error: %i)", error); + @"You may need to open System Preferences : Displays : Color " + @"and manually restore your color settings. (Error: %ld)", + (long)error); // COV_NF_END } else { _GTMDevLog(@"Color profile restored"); diff --git a/UnitTesting/GTMNSObject+UnitTesting.m b/UnitTesting/GTMNSObject+UnitTesting.m index f72ba88..5de6d05 100644 --- a/UnitTesting/GTMNSObject+UnitTesting.m +++ b/UnitTesting/GTMNSObject+UnitTesting.m @@ -539,9 +539,10 @@ static NSString *gGTMUnitTestSaveToDirectory = nil; [GTMSystemVersion getMajor:&major minor:&minor bugFix:&bugFix]; NSString *systemVersions[4]; systemVersions[0] = [NSString stringWithFormat:@".%d.%d.%d", - major, minor, bugFix]; - systemVersions[1] = [NSString stringWithFormat:@".%d.%d", major, minor]; - systemVersions[2] = [NSString stringWithFormat:@".%d", major]; + (int)major, (int)minor, (int)bugFix]; + systemVersions[1] + = [NSString stringWithFormat:@".%d.%d", (int)major, (int)minor]; + systemVersions[2] = [NSString stringWithFormat:@".%d", (int)major]; systemVersions[3] = @""; // Architecture NSString *architecture[2]; @@ -620,7 +621,7 @@ static NSString *gGTMUnitTestSaveToDirectory = nil; // We don't include the CompilerSDK in here because it is not something that // that is commonly needed. NSString *fullName = [NSString stringWithFormat:@"%@.%d.%d.%d.%@", - name, major, minor, bugFix, systemArchitecture]; + name, (int)major, (int)minor, (int)bugFix, systemArchitecture]; NSString *basePath = [[self class] gtm_getUnitTestSaveToDirectory]; return [[basePath stringByAppendingPathComponent:fullName] diff --git a/UnitTesting/GTMSenTestCase.h b/UnitTesting/GTMSenTestCase.h index 9884543..3dac15b 100644 --- a/UnitTesting/GTMSenTestCase.h +++ b/UnitTesting/GTMSenTestCase.h @@ -78,7 +78,7 @@ do { \ @try { \ OSStatus a1value = (a1); \ if (a1value != noErr) { \ - NSString *_expression = [NSString stringWithFormat:@"Expected noErr, got %ld for (%s)", a1value, #a1]; \ + NSString *_expression = [NSString stringWithFormat:@"Expected noErr, got %ld for (%s)", (long)a1value, #a1]; \ [self failWithException:([NSException failureInCondition:_expression \ isTrue:NO \ inFile:[NSString stringWithUTF8String:__FILE__] \ @@ -108,7 +108,7 @@ do { \ OSStatus a1value = (a1); \ OSStatus a2value = (a2); \ if (a1value != a2value) { \ - NSString *_expression = [NSString stringWithFormat:@"Expected %s(%ld) but got %ld for (%s)", #a2, a2value, a1value, #a1]; \ + NSString *_expression = [NSString stringWithFormat:@"Expected %s(%ld) but got %ld for (%s)", #a2, (long)a2value, (long)a1value, #a1]; \ [self failWithException:([NSException failureInCondition:_expression \ isTrue:NO \ inFile:[NSString stringWithUTF8String:__FILE__] \ @@ -1015,32 +1015,32 @@ do { \ @interface NSException (GTMSenTestAdditions) + (NSException *)failureInFile:(NSString *)filename atLine:(int)lineNumber - withDescription:(NSString *)formatString, ...; + withDescription:(NSString *)formatString, ... NS_FORMAT_FUNCTION(3, 4); + (NSException *)failureInCondition:(NSString *)condition isTrue:(BOOL)isTrue inFile:(NSString *)filename atLine:(int)lineNumber - withDescription:(NSString *)formatString, ...; + withDescription:(NSString *)formatString, ... NS_FORMAT_FUNCTION(5, 6); + (NSException *)failureInEqualityBetweenObject:(id)left andObject:(id)right inFile:(NSString *)filename atLine:(int)lineNumber - withDescription:(NSString *)formatString, ...; + withDescription:(NSString *)formatString, ... NS_FORMAT_FUNCTION(5, 6); + (NSException *)failureInEqualityBetweenValue:(NSValue *)left andValue:(NSValue *)right withAccuracy:(NSValue *)accuracy inFile:(NSString *)filename atLine:(int) ineNumber - withDescription:(NSString *)formatString, ...; + withDescription:(NSString *)formatString, ... NS_FORMAT_FUNCTION(6, 7); + (NSException *)failureInRaise:(NSString *)expression inFile:(NSString *)filename atLine:(int)lineNumber - withDescription:(NSString *)formatString, ...; + withDescription:(NSString *)formatString, ... NS_FORMAT_FUNCTION(4, 5); + (NSException *)failureInRaise:(NSString *)expression exception:(NSException *)exception inFile:(NSString *)filename atLine:(int)lineNumber - withDescription:(NSString *)formatString, ...; + withDescription:(NSString *)formatString, ... NS_FORMAT_FUNCTION(5, 6); @end // SENTE_END diff --git a/UnitTesting/GTMSenTestCase.m b/UnitTesting/GTMSenTestCase.m index 5607c31..4906c19 100644 --- a/UnitTesting/GTMSenTestCase.m +++ b/UnitTesting/GTMSenTestCase.m @@ -198,6 +198,8 @@ @end +NSString *STComposeString(NSString *formatString, ...) NS_FORMAT_FUNCTION(1, 2); + NSString *STComposeString(NSString *formatString, ...) { NSString *reason = @""; if (formatString) { |