aboutsummaryrefslogtreecommitdiff
path: root/UnitTesting
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-06-04 15:35:57 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-06-04 15:35:57 +0000
commit6c2f14bc180418cfad42582be6ef1cc6a5413368 (patch)
tree3b2b46d62d4889ba0e57f0fcbbc27e400ab5a22a /UnitTesting
parent8ceff783b1fd62b67c7a6301228af9f7266e183b (diff)
[Author: dmaclach]
Turns on the undeclared-selector warning. This may cause builds to fail if they are using our configs. Also cleaned up some whitespace issues. R=thomasvl DELTA=94 (71 added, 22 deleted, 1 changed)
Diffstat (limited to 'UnitTesting')
-rw-r--r--UnitTesting/GTMIPhoneUnitTestDelegate.m23
-rw-r--r--UnitTesting/GTMSenTestCase.m21
2 files changed, 26 insertions, 18 deletions
diff --git a/UnitTesting/GTMIPhoneUnitTestDelegate.m b/UnitTesting/GTMIPhoneUnitTestDelegate.m
index 9f2457d..dc4b182 100644
--- a/UnitTesting/GTMIPhoneUnitTestDelegate.m
+++ b/UnitTesting/GTMIPhoneUnitTestDelegate.m
@@ -6,9 +6,9 @@
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -27,6 +27,13 @@
#import <UIKit/UIKit.h>
#import "GTMSenTestCase.h"
+@interface UIApplication (GTMIPhoneUnitTestDelegate)
+
+// SPI that we need to exti cleanly with a value.
+- (void)_terminateWithStatus:(int)status;
+
+@end
+
@implementation GTMIPhoneUnitTestDelegate
// Run through all the registered classes and run test methods on any
@@ -34,7 +41,7 @@
// test completion.
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[self runTests];
-
+
if (!getenv("GTM_DISABLE_TERMINATION")) {
// To help using xcodebuild, make the exit status 0/1 to signal the tests
// success/failure.
@@ -87,7 +94,7 @@
if ([invocations count]) {
NSInvocation *invocation;
GTM_FOREACH_OBJECT(invocation, invocations) {
- GTMTestCase *testCase
+ GTMTestCase *testCase
= [[currClass alloc] initWithInvocation:invocation];
BOOL failed = NO;
NSDate *caseStartDate = [NSDate date];
@@ -128,14 +135,14 @@
@"Executed %d tests, with %d failures (%d "
@"unexpected) in %0.3f (%0.3f) seconds\n\n",
fixtureName, fixtureEndDate,
- fixtureSuccesses + fixtureFailures,
+ fixtureSuccesses + fixtureFailures,
fixtureFailures, fixtureFailures,
fixtureEndTime, fixtureEndTime];
-
+
fputs([fixtureEndString UTF8String], stderr);
fflush(stderr);
totalSuccesses_ += fixtureSuccesses;
- totalFailures_ += fixtureFailures;
+ totalFailures_ += fixtureFailures;
}
[pool release];
}
@@ -147,7 +154,7 @@
@"Executed %d tests, with %d failures (%d "
@"unexpected) in %0.3f (%0.3f) seconds\n\n",
suiteName, suiteEndDate,
- totalSuccesses_ + totalFailures_,
+ totalSuccesses_ + totalFailures_,
totalFailures_, totalFailures_,
suiteEndTime, suiteEndTime];
fputs([suiteEndString UTF8String], stderr);
diff --git a/UnitTesting/GTMSenTestCase.m b/UnitTesting/GTMSenTestCase.m
index e909294..a766717 100644
--- a/UnitTesting/GTMSenTestCase.m
+++ b/UnitTesting/GTMSenTestCase.m
@@ -19,6 +19,7 @@
#import "GTMSenTestCase.h"
#import <unistd.h>
#import "GTMObjC2Runtime.h"
+#import "GTMUnitTestDevLog.h"
#if !GTM_IPHONE_SDK
#import "GTMGarbageCollection.h"
@@ -310,7 +311,7 @@ NSString *const SenTestLineNumberKey = @"SenTestLineNumberKey";
- (NSString *)description {
// This matches the description OCUnit would return to you
- return [NSString stringWithFormat:@"-[%@ %@]", [self class],
+ return [NSString stringWithFormat:@"-[%@ %@]", [self class],
NSStringFromSelector([self selector])];
}
@@ -355,7 +356,7 @@ static int MethodSort(const void *a, const void *b) {
&& strcmp(returnType, @encode(void)) == 0
&& method_getNumberOfArguments(currMethod) == 2) {
NSMethodSignature *sig = [self instanceMethodSignatureForSelector:sel];
- NSInvocation *invocation
+ NSInvocation *invocation
= [NSInvocation invocationWithMethodSignature:sig];
[invocation setSelector:sel];
[invocations addObject:invocation];
@@ -407,8 +408,8 @@ static int MethodSort(const void *a, const void *b) {
// COV_NF_START
// We don't have leak checking on by default, so this won't be hit.
static void _GTMRunLeaks(void) {
- // This is an atexit handler. It runs leaks for us to check if we are
- // leaking anything in our tests.
+ // This is an atexit handler. It runs leaks for us to check if we are
+ // leaking anything in our tests.
const char* cExclusionsEnv = getenv("GTM_LEAKS_SYMBOLS_TO_IGNORE");
NSMutableString *exclusions = [NSMutableString string];
if (cExclusionsEnv) {
@@ -421,13 +422,13 @@ static void _GTMRunLeaks(void) {
[exclusions appendFormat:@"-exclude \"%@\" ", exclusion];
}
}
- NSString *string
+ NSString *string
= [NSString stringWithFormat:@"/usr/bin/leaks %@%d"
- @"| /usr/bin/sed -e 's/Leak: /Leaks:0: warning: Leak /'",
+ @"| /usr/bin/sed -e 's/Leak: /Leaks:0: warning: Leak /'",
exclusions, getpid()];
int ret = system([string UTF8String]);
if (ret) {
- fprintf(stderr, "%s:%d: Error: Unable to run leaks. 'system' returned: %d",
+ fprintf(stderr, "%s:%d: Error: Unable to run leaks. 'system' returned: %d",
__FILE__, __LINE__, ret);
fflush(stderr);
}
@@ -447,11 +448,11 @@ static __attribute__((constructor)) void _GTMInstallLeaks(void) {
fprintf(stderr, "Leak Checking Enabled\n");
fflush(stderr);
int ret = atexit(&_GTMRunLeaks);
- _GTMDevAssert(ret == 0,
- @"Unable to install _GTMRunLeaks as an atexit handler (%d)",
+ _GTMDevAssert(ret == 0,
+ @"Unable to install _GTMRunLeaks as an atexit handler (%d)",
errno);
// COV_NF_END
- }
+ }
}
}