Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

iOSTest works with ARC

Commit
2969a0df415542e8eeb4eb51d4923382cdba6825
Author
Phil Nash ·
Parents
53c990a7e196

Files · Download .tar.gz

Changes

 projects/XCode4/iOSTest/iOSTest.xcodeproj/project.pbxproj    | 2 ++
 projects/XCode4/iOSTest/iOSTest/OCTest.mm                    | 2 +-
 projects/runners/iTchRunner/internal/iTchRunnerAppDelegate.h | 4 +++-
 projects/runners/iTchRunner/internal/iTchRunnerMainView.h    | 8 +++++---
 projects/runners/iTchRunner/itChRunnerMain.mm                | 8 +++++++-
 5 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/projects/XCode4/iOSTest/iOSTest.xcodeproj/project.pbxproj b/projects/XCode4/iOSTest/iOSTest.xcodeproj/project.pbxproj
index 1acdb272..e968cf62 100644
--- a/projects/XCode4/iOSTest/iOSTest.xcodeproj/project.pbxproj
+++ b/projects/XCode4/iOSTest/iOSTest.xcodeproj/project.pbxproj
@@ -202,6 +202,7 @@
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				CLANG_ENABLE_OBJC_ARC = YES;
 				CODE_SIGN_IDENTITY = "iPhone Developer: Phil Nash (4KJCM5XSVL)";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				COPY_PHASE_STRIP = NO;
@@ -230,6 +231,7 @@
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+				CLANG_ENABLE_OBJC_ARC = YES;
 				CODE_SIGN_IDENTITY = "iPhone Developer: Phil Nash (4KJCM5XSVL)";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				COPY_PHASE_STRIP = YES;
diff --git a/projects/XCode4/iOSTest/iOSTest/OCTest.mm b/projects/XCode4/iOSTest/iOSTest/OCTest.mm
index c69575a6..d476cb42 100644
--- a/projects/XCode4/iOSTest/iOSTest/OCTest.mm
+++ b/projects/XCode4/iOSTest/iOSTest/OCTest.mm
@@ -23,5 +23,5 @@ TEST_CASE( "OCTest/TestObj", "tests TestObj" )
     
     REQUIRE( obj.int_val == 1 );
     
-    [obj release];
+    arcSafeRelease( obj );
 }
diff --git a/projects/runners/iTchRunner/internal/iTchRunnerAppDelegate.h b/projects/runners/iTchRunner/internal/iTchRunnerAppDelegate.h
index 4fcf8044..4f83286d 100644
--- a/projects/runners/iTchRunner/internal/iTchRunnerAppDelegate.h
+++ b/projects/runners/iTchRunner/internal/iTchRunnerAppDelegate.h
@@ -34,7 +34,7 @@
     
     [window addSubview:view];
     [window makeKeyAndVisible];
-    [view release];
+    arcSafeRelease( view );
 
     return YES;
 }
@@ -42,8 +42,10 @@
 ///////////////////////////////////////////////////////////////////////////////
 - (void)dealloc 
 {
+#if !CATCH_ARC_ENABLED
     [window release];
     [super dealloc];
+#endif
 }
 
 
diff --git a/projects/runners/iTchRunner/internal/iTchRunnerMainView.h b/projects/runners/iTchRunner/internal/iTchRunnerMainView.h
index 721c4918..d2a98579 100644
--- a/projects/runners/iTchRunner/internal/iTchRunnerMainView.h
+++ b/projects/runners/iTchRunner/internal/iTchRunnerMainView.h
@@ -38,9 +38,9 @@
         
         appName = [[UITextField alloc] initWithFrame: CGRectMake( 0, 50, 320, 50 )];
         [self addSubview: appName];
-        [appName release];
+        arcSafeRelease( appName );
         appName.textColor = [[UIColor alloc] initWithRed:0.35 green:0.35 blue:1 alpha:1];
-        [appName.textColor release];
+        arcSafeRelease( appName.textColor );
         appName.textAlignment = UITextAlignmentCenter;
         
         appName.text = [NSString stringWithFormat:@"CATCH tests"];
@@ -55,7 +55,9 @@
 -(void) dealloc
 {
     [appName removeFromSuperview];
+#if !CATCH_ARC_ENABLED
     [super dealloc];
+#endif
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -67,7 +69,7 @@
                                         destructiveButtonTitle:nil
                                              otherButtonTitles:@"Run all tests", nil];
     [menu showInView: self];
-    [menu release];
+    arcSafeRelease( menu );
  
 }
 
diff --git a/projects/runners/iTchRunner/itChRunnerMain.mm b/projects/runners/iTchRunner/itChRunnerMain.mm
index 22f03efd..a28bc756 100644
--- a/projects/runners/iTchRunner/itChRunnerMain.mm
+++ b/projects/runners/iTchRunner/itChRunnerMain.mm
@@ -11,10 +11,16 @@
 
 int main(int argc, char *argv[]) 
 {    
+#if !CATCH_ARC_ENABLED
     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
-
+#endif
+    
     Catch::registerTestMethods();
     int retVal = UIApplicationMain(argc, argv, nil, @"iTchRunnerAppDelegate");
+
+#if !CATCH_ARC_ENABLED
     [pool release];
+#endif
+
     return retVal;
 }