diff options
author | thomasvl@gmail.com <thomasvl@gmail.com@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2008-09-22 23:33:44 +0000 |
---|---|---|
committer | thomasvl@gmail.com <thomasvl@gmail.com@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2008-09-22 23:33:44 +0000 |
commit | 7bb8e9b9b24141f373ed70d7e6674a245c0227cf (patch) | |
tree | 8fab3cad46943aee24f213e041b2a7f6b71ea5df /iPhone | |
parent | bfaf8705cccb15c0c2a7704b17ba011ddba8242f (diff) |
- Added GTMTestTimer.h for doing high fidelity timings.
- Added leaks checking to iPhone unit test script. It can be controlled by
the GTM_DISABLE_LEAKS environment variable
- Added ability to control using zombies to iPhone unit test script. It can be
controlled by the GTM_DISABLE_ZOMBIES environment variable
- Added ability to control termination to iPhone unit test script. It can be
controlled by the GTM_DISABLE_TERMINATION environment variable
- Fixed several leaks found with leak checking enabled.
- Added configs for different iPhone OS versions.
Diffstat (limited to 'iPhone')
-rw-r--r-- | iPhone/GTMABAddressBook.m | 3 | ||||
-rw-r--r-- | iPhone/GTMABAddressBookTest.m | 33 |
2 files changed, 23 insertions, 13 deletions
diff --git a/iPhone/GTMABAddressBook.m b/iPhone/GTMABAddressBook.m index 0c54364..c06b511 100644 --- a/iPhone/GTMABAddressBook.m +++ b/iPhone/GTMABAddressBook.m @@ -189,6 +189,7 @@ typedef struct { - (id)initWithRecord:(ABRecordRef)record { if ((self = [super init])) { if ([self class] == [GTMABRecord class]) { + [self autorelease]; [self doesNotRecognizeSelector:_cmd]; } if (!record) { @@ -509,6 +510,8 @@ typedef struct { @implementation GTMABMultiValue - (id)init { + // Call super init and release so we don't leak + [[super init] autorelease]; [self doesNotRecognizeSelector:_cmd]; return nil; // COV_NF_LINE } diff --git a/iPhone/GTMABAddressBookTest.m b/iPhone/GTMABAddressBookTest.m index 3ecb796..56106a9 100644 --- a/iPhone/GTMABAddressBookTest.m +++ b/iPhone/GTMABAddressBookTest.m @@ -534,24 +534,31 @@ thirdRetainCount, @"Testing type %d, %@", type, val); + id oldVal = val; val = (id)ABMultiValueCopyValueAtIndex(ref, 0); NSUInteger fourthRetainCount = [val retainCount]; - if (type == kABIntegerPropertyType - || type == kABRealPropertyType - || type == kABDictionaryPropertyType) { - // We are verifying that yes indeed 6208390 is still broken - STAssertEquals(fourthRetainCount, - thirdRetainCount, - @"Testing type %d, %@. If you see this error it may " - @"be time to update the code to change retain behaviors" - @"with this os version", type, val); + + // kABDictionaryPropertyTypes appear to do an actual copy, so the retain + // count checking trick won't work. We only check the retain count if + // we didn't get a new version. + if (val == oldVal) { + if (type == kABIntegerPropertyType + || type == kABRealPropertyType) { + // We are verifying that yes indeed 6208390 is still broken + STAssertEquals(fourthRetainCount, + thirdRetainCount, + @"Testing type %d, %@. If you see this error it may " + @"be time to update the code to change retain behaviors" + @"with this os version", type, val); + } else { + STAssertEquals(fourthRetainCount, + thirdRetainCount + 1, + @"Testing type %d, %@", type, val); + [val release]; + } } else { - STAssertEquals(fourthRetainCount, - thirdRetainCount + 1, - @"Testing type %d, %@", type, val); [val release]; } - CFRelease(ref); } } |