diff options
author | thomasvl@gmail.com <thomasvl@gmail.com@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-03-09 21:01:39 +0000 |
---|---|---|
committer | thomasvl@gmail.com <thomasvl@gmail.com@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-03-09 21:01:39 +0000 |
commit | a5ada143459a5858341030c33180b36f7542e4d1 (patch) | |
tree | 40e57a6084630ec038a1968b9d98ace102239ab2 | |
parent | e1bcf5d6a4b813a63d42e6ccb37ca8054775d65b (diff) |
Remove some NF comments on code that was being hit.
Added a stack trace test to make sure all code paths are covered.
-rw-r--r-- | Foundation/GTMSQLite.m | 10 | ||||
-rw-r--r-- | Foundation/GTMStackTraceTest.m | 24 |
2 files changed, 26 insertions, 8 deletions
diff --git a/Foundation/GTMSQLite.m b/Foundation/GTMSQLite.m index 01e3bad..73f6a22 100644 --- a/Foundation/GTMSQLite.m +++ b/Foundation/GTMSQLite.m @@ -240,11 +240,9 @@ static CFLocaleRef gCurrentLocale = NULL; if (db_) { int rc = sqlite3_close(db_); if (rc != SQLITE_OK) { - // COV_NF_START _GTMDevLog(@"Unable to close \"%@\", error code: %d", self, rc); _GTMDevLog(@"Did you forget to call -[GTMSQLiteStatement" @" finalizeStatement] on one of your statements?"); - // COV_NF_END } } [path_ release]; @@ -1286,24 +1284,20 @@ static void LikeGlobCompare(sqlite3_context *context, !((patternChar == matchAll) || (patternChar == matchOne) || (setSupport && (patternChar == 0x5B)))) { // "[" if (patternChar == escape) { - // COV_NF_START - this code doesn't appear to be hittable - // setSupport implies that the escape char is NULL - // additionally, setSupport implies GLOB, and running a GLOB - // query with an escape clause appears to not work in SQLITE3 - // when I tried it from the command line // No matter what the character follows the escape copy it to the // buffer patternIndex++; if (patternIndex >= patternLength) { + // COV_NF_START // Oops, escape came at end of pattern, that's an error sqlite3_result_error(context, "LIKE or GLOB CF implementation found " \ "escape character at end of pattern", -1); return; + // COV_NF_END } patternChar = CFStringGetCharacterFromInlineBuffer(&patternBuffer, patternIndex); - // COV_NF_END } // At this point the patternChar is either the escaped character or the // original normal character diff --git a/Foundation/GTMStackTraceTest.m b/Foundation/GTMStackTraceTest.m index 457f3e9..f1c1247 100644 --- a/Foundation/GTMStackTraceTest.m +++ b/Foundation/GTMStackTraceTest.m @@ -45,6 +45,30 @@ stacktrace); } +-(void)testGetStackAddressDescriptors { + struct GTMAddressDescriptor descs[100]; + size_t depth = sizeof(descs) / sizeof(struct GTMAddressDescriptor); + depth = GTMGetStackAddressDescriptors(descs, depth); + // Got atleast 4... + STAssertGreaterThan(depth, (size_t)4, nil); + // All that we got have symbols + for (NSUInteger lp = 0 ; lp < depth ; ++lp) { + STAssertNotNULL(descs[lp].symbol, @"didn't get a symble at depth %lu", lp); + } + + // Do it again, but don't give it enough space (to make sure it handles that) + size_t fullDepth = depth; + STAssertGreaterThan(fullDepth, (size_t)4, nil); + depth -= 2; + depth = GTMGetStackAddressDescriptors(descs, depth); + STAssertLessThan(depth, fullDepth, nil); + // All that we got have symbols + for (NSUInteger lp = 0 ; lp < depth ; ++lp) { + STAssertNotNULL(descs[lp].symbol, @"didn't get a symble at depth %lu", lp); + } + +} + #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 - (void)helperThatThrows { |