aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMSQLiteTest.m
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2013-12-19 21:30:10 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2013-12-19 21:30:10 +0000
commit9b8635767148b3f95942593bfeefa86f147d2c53 (patch)
tree357cf2390edbb1d150830133228cda393203ee48 /Foundation/GTMSQLiteTest.m
parentca3d74790bcf2d42bc6a9c3dc653c7e8a485705c (diff)
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)
Diffstat (limited to 'Foundation/GTMSQLiteTest.m')
-rw-r--r--Foundation/GTMSQLiteTest.m73
1 files changed, 34 insertions, 39 deletions
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 {