From 9b8635767148b3f95942593bfeefa86f147d2c53 Mon Sep 17 00:00:00 2001 From: "gtm.daemon" Date: Thu, 19 Dec 2013 21:30:10 +0000 Subject: Fix build of Mac GTM project with static analyzer. Remove GTMGarbageCollection. Remove GC build configs. Remove internal dependence on GTMObjectSingleton. DELTA=447 (49 added, 296 deleted, 102 changed) --- Foundation/GTMSQLiteTest.m | 73 +++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 39 deletions(-) (limited to 'Foundation/GTMSQLiteTest.m') diff --git a/Foundation/GTMSQLiteTest.m b/Foundation/GTMSQLiteTest.m index a158a4f..8a5f18d 100644 --- a/Foundation/GTMSQLiteTest.m +++ b/Foundation/GTMSQLiteTest.m @@ -20,7 +20,6 @@ #import "GTMSQLite.h" #import "GTMSenTestCase.h" #import "GTMUnitTestDevLog.h" -#import "GTMGarbageCollection.h" @interface GTMSQLiteTest : GTMTestCase @end @@ -1744,51 +1743,47 @@ static NSArray* LikeGlobTestHelper(GTMSQLiteDatabase *db, NSString *sql) { } - (void)testThatNotFinalizingStatementsThrowsAssertion { - // The run-time check is discouraged, but we're using it because the - // same test binary is used for both GC & Non-GC runs - if (!GTMIsGarbageCollectionEnabled()) { - NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init]; + NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init]; - int err; - GTMSQLiteDatabase *db = - [[[GTMSQLiteDatabase alloc] initInMemoryWithCFAdditions:YES - utf8:YES - errorCode:&err] - autorelease]; + int err; + GTMSQLiteDatabase *db = + [[[GTMSQLiteDatabase alloc] initInMemoryWithCFAdditions:YES + utf8:YES + errorCode:&err] + autorelease]; - STAssertNotNil(db, @"Failed to create database"); + STAssertNotNil(db, @"Failed to create database"); - sqlite3 *sqlite3DB = [db sqlite3DB]; - - NSString *selectSQL = @"select 1"; - GTMSQLiteStatement *statement; - statement = [GTMSQLiteStatement statementWithSQL:selectSQL - inDatabase:db - errorCode:&err]; - STAssertNotNil(statement, @"Failed to create select statement"); - STAssertEquals(err, SQLITE_OK, @"Failed to create select statement"); + sqlite3 *sqlite3DB = [db sqlite3DB]; + + NSString *selectSQL = @"select 1"; + GTMSQLiteStatement *statement; + statement = [GTMSQLiteStatement statementWithSQL:selectSQL + inDatabase:db + errorCode:&err]; + STAssertNotNil(statement, @"Failed to create select statement"); + STAssertEquals(err, SQLITE_OK, @"Failed to create select statement"); - sqlite3_stmt *sqlite3Statment = [statement sqlite3Statement]; + sqlite3_stmt *sqlite3Statment = [statement sqlite3Statement]; - err = [statement stepRow]; - STAssertEquals(err, SQLITE_ROW, - @"failed to step row for finalize test"); + err = [statement stepRow]; + STAssertEquals(err, SQLITE_ROW, + @"failed to step row for finalize test"); - NSString *expectedLog = - @"-[GTMSQLiteStatement finalizeStatement] must be called " - @"when statement is no longer needed"; + NSString *expectedLog = + @"-[GTMSQLiteStatement finalizeStatement] must be called " + @"when statement is no longer needed"; - [GTMUnitTestDevLog expectString:@"%@", expectedLog]; - [GTMUnitTestDevLog expectPattern:@"Unable to close .*"]; - [localPool drain]; - - // Clean up leaks. Since we hadn't finalized the statement above we - // were unable to clean up the sqlite databases. Since the pool is drained - // all of our objective-c objects are gone, so we have to call the - // sqlite3 api directly. - STAssertEquals(sqlite3_finalize(sqlite3Statment), SQLITE_OK, nil); - STAssertEquals(sqlite3_close(sqlite3DB), SQLITE_OK, nil); - } + [GTMUnitTestDevLog expectString:@"%@", expectedLog]; + [GTMUnitTestDevLog expectPattern:@"Unable to close .*"]; + [localPool drain]; + + // Clean up leaks. Since we hadn't finalized the statement above we + // were unable to clean up the sqlite databases. Since the pool is drained + // all of our objective-c objects are gone, so we have to call the + // sqlite3 api directly. + STAssertEquals(sqlite3_finalize(sqlite3Statment), SQLITE_OK, nil); + STAssertEquals(sqlite3_close(sqlite3DB), SQLITE_OK, nil); } - (void)testCompleteSQLString { -- cgit v1.2.3