iOSTest works with ARC

This commit is contained in:
Phil Nash 2012-03-17 18:36:00 +00:00
parent 53c990a7e1
commit 2969a0df41
5 changed files with 18 additions and 6 deletions

View File

@ -202,6 +202,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)"; ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "iPhone Developer: Phil Nash (4KJCM5XSVL)"; CODE_SIGN_IDENTITY = "iPhone Developer: Phil Nash (4KJCM5XSVL)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
@ -230,6 +231,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)"; ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "iPhone Developer: Phil Nash (4KJCM5XSVL)"; CODE_SIGN_IDENTITY = "iPhone Developer: Phil Nash (4KJCM5XSVL)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES; COPY_PHASE_STRIP = YES;

View File

@ -23,5 +23,5 @@ TEST_CASE( "OCTest/TestObj", "tests TestObj" )
REQUIRE( obj.int_val == 1 ); REQUIRE( obj.int_val == 1 );
[obj release]; arcSafeRelease( obj );
} }

View File

@ -34,7 +34,7 @@
[window addSubview:view]; [window addSubview:view];
[window makeKeyAndVisible]; [window makeKeyAndVisible];
[view release]; arcSafeRelease( view );
return YES; return YES;
} }
@ -42,8 +42,10 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
- (void)dealloc - (void)dealloc
{ {
#if !CATCH_ARC_ENABLED
[window release]; [window release];
[super dealloc]; [super dealloc];
#endif
} }

View File

@ -38,9 +38,9 @@
appName = [[UITextField alloc] initWithFrame: CGRectMake( 0, 50, 320, 50 )]; appName = [[UITextField alloc] initWithFrame: CGRectMake( 0, 50, 320, 50 )];
[self addSubview: appName]; [self addSubview: appName];
[appName release]; arcSafeRelease( appName );
appName.textColor = [[UIColor alloc] initWithRed:0.35 green:0.35 blue:1 alpha:1]; appName.textColor = [[UIColor alloc] initWithRed:0.35 green:0.35 blue:1 alpha:1];
[appName.textColor release]; arcSafeRelease( appName.textColor );
appName.textAlignment = UITextAlignmentCenter; appName.textAlignment = UITextAlignmentCenter;
appName.text = [NSString stringWithFormat:@"CATCH tests"]; appName.text = [NSString stringWithFormat:@"CATCH tests"];
@ -55,7 +55,9 @@
-(void) dealloc -(void) dealloc
{ {
[appName removeFromSuperview]; [appName removeFromSuperview];
#if !CATCH_ARC_ENABLED
[super dealloc]; [super dealloc];
#endif
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -67,7 +69,7 @@
destructiveButtonTitle:nil destructiveButtonTitle:nil
otherButtonTitles:@"Run all tests", nil]; otherButtonTitles:@"Run all tests", nil];
[menu showInView: self]; [menu showInView: self];
[menu release]; arcSafeRelease( menu );
} }

View File

@ -11,10 +11,16 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#if !CATCH_ARC_ENABLED
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
#endif
Catch::registerTestMethods(); Catch::registerTestMethods();
int retVal = UIApplicationMain(argc, argv, nil, @"iTchRunnerAppDelegate"); int retVal = UIApplicationMain(argc, argv, nil, @"iTchRunnerAppDelegate");
#if !CATCH_ARC_ENABLED
[pool release]; [pool release];
#endif
return retVal; return retVal;
} }