aboutsummaryrefslogtreecommitdiff
path: root/Foundation
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2013-02-13 17:30:09 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2013-02-13 17:30:09 +0000
commite87795d0d15fd8b725b2e4899275aa713d39e9e3 (patch)
tree72b445079e5528f0eda4ba0edd9d919dc863251e /Foundation
parent0a3fae419f654ceb4c708300f7bd7702cbb12db1 (diff)
No need for [self class] in a class method.
DELTA=26 (0 added, 0 deleted, 26 changed)
Diffstat (limited to 'Foundation')
-rw-r--r--Foundation/GTMNSNumber+64Bit.m14
-rw-r--r--Foundation/GTMNSThread+Blocks.m2
-rw-r--r--Foundation/GTMSignalHandlerTest.m2
-rw-r--r--Foundation/GTMValidatingContainers.m130
-rw-r--r--Foundation/GTMValidatingContainersTest.m96
5 files changed, 122 insertions, 122 deletions
diff --git a/Foundation/GTMNSNumber+64Bit.m b/Foundation/GTMNSNumber+64Bit.m
index 49d5c4d..c3b1762 100644
--- a/Foundation/GTMNSNumber+64Bit.m
+++ b/Foundation/GTMNSNumber+64Bit.m
@@ -6,9 +6,9 @@
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -20,15 +20,15 @@
@implementation NSNumber (GTM64BitAdditions)
+ (NSNumber *)gtm_numberWithCGFloat:(CGFloat)value {
- return [[[[self class] alloc] gtm_initWithCGFloat:value] autorelease];
+ return [[[self alloc] gtm_initWithCGFloat:value] autorelease];
}
+ (NSNumber *)gtm_numberWithInteger:(NSInteger)value {
- return [[[[self class] alloc] gtm_initWithInteger:value] autorelease];
+ return [[[self alloc] gtm_initWithInteger:value] autorelease];
}
+ (NSNumber *)gtm_numberWithUnsignedInteger:(NSUInteger)value {
- return [[[[self class] alloc] gtm_initWithUnsignedInteger:value] autorelease];
+ return [[[self alloc] gtm_initWithUnsignedInteger:value] autorelease];
}
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
@@ -65,7 +65,7 @@
- (id)gtm_initWithCGFloat:(CGFloat)value {
#if defined(__LP64__) && __LP64__
return [self initWithDouble:value];
-#else
+#else
return [self initWithFloat:value];
#endif // defined(__LP64__) && __LP64__
}
@@ -73,7 +73,7 @@
- (CGFloat)gtm_cgFloatValue {
#if defined(__LP64__) && __LP64__
return [self doubleValue];
-#else
+#else
return [self floatValue];
#endif // defined(__LP64__) && __LP64__
}
diff --git a/Foundation/GTMNSThread+Blocks.m b/Foundation/GTMNSThread+Blocks.m
index d8660cc..a3941fb 100644
--- a/Foundation/GTMNSThread+Blocks.m
+++ b/Foundation/GTMNSThread+Blocks.m
@@ -70,7 +70,7 @@ enum {
@implementation GTMSimpleWorkerThread
+ (void)initialize {
- if ([self class] == [GTMSimpleWorkerThread class]) {
+ if (self == [GTMSimpleWorkerThread class]) {
// Resolve pthread_setname_np() on 10.6 and later.
gPThreadSetNameNP = dlsym(RTLD_DEFAULT, "pthread_setname_np");
}
diff --git a/Foundation/GTMSignalHandlerTest.m b/Foundation/GTMSignalHandlerTest.m
index f284860..5cddcb5 100644
--- a/Foundation/GTMSignalHandlerTest.m
+++ b/Foundation/GTMSignalHandlerTest.m
@@ -39,7 +39,7 @@
@implementation SignalCounter
+ (id)signalCounter {
- return [[[[self class] alloc] init] autorelease];
+ return [[[self alloc] init] autorelease];
}
- (int)count {
return signalCount_;
diff --git a/Foundation/GTMValidatingContainers.m b/Foundation/GTMValidatingContainers.m
index 3dcab68..a227ad4 100644
--- a/Foundation/GTMValidatingContainers.m
+++ b/Foundation/GTMValidatingContainers.m
@@ -1,7 +1,7 @@
//
// GTMValidatingContainers.m
//
-// Mutable containers that do verification of objects being added to them
+// Mutable containers that do verification of objects being added to them
// at runtime. Support for arrays, dictionaries and sets.
//
// Documentation on subclassing class clusters (which we are doing) is here:
@@ -12,9 +12,9 @@
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -38,21 +38,21 @@ GTM_INLINE BOOL VerifyObjectWithTargetAndSelectorForContainer(id anObject,
id target,
SEL selector,
id container) {
- // We must take care here, since Intel leaves junk in high bytes of return
+ // We must take care here, since Intel leaves junk in high bytes of return
// register for predicates that return BOOL.
- // For details see:
+ // For details see:
// http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_tips/chapter_5_section_23.html
// and
// http://www.red-sweater.com/blog/320/abusing-objective-c-with-class#comment-83187
- BOOL isGood = ((BOOL (*)(id, SEL, id, id))objc_msgSend)(target, selector,
+ BOOL isGood = ((BOOL (*)(id, SEL, id, id))objc_msgSend)(target, selector,
anObject, container);
if (!isGood) {
#if GTM_CONTAINERS_VALIDATION_FAILED_ASSERT
- _GTMDevAssert(isGood, @"%@ failed container verification for %@",
+ _GTMDevAssert(isGood, @"%@ failed container verification for %@",
anObject, [container description]);
#endif // GTM_CONTAINERS_VALIDATION_FAILED_LOG
#if GTM_CONTAINERS_VALIDATION_FAILED_LOG
- _GTMDevLog(@"%@ failed container verification for %@", anObject,
+ _GTMDevLog(@"%@ failed container verification for %@", anObject,
[container description]);
#endif // GTM_CONTAINERS_VALIDATION_FAILED_LOG
}
@@ -60,43 +60,43 @@ GTM_INLINE BOOL VerifyObjectWithTargetAndSelectorForContainer(id anObject,
}
GTM_INLINE void VerifySelectorOnTarget(SEL sel, id target) {
- GTMAssertSelectorNilOrImplementedWithReturnTypeAndArguments(target,
- sel,
- @encode(BOOL),
- @encode(id),
+ GTMAssertSelectorNilOrImplementedWithReturnTypeAndArguments(target,
+ sel,
+ @encode(BOOL),
+ @encode(id),
@encode(id),
nil);
-}
+}
void _GTMValidateContainerContainsKindOfClass(id container, Class cls) {
GTMKindOfClassValidator *validator;
validator = [GTMKindOfClassValidator validateAgainstClass:cls];
- _GTMValidateContainer(container,
- validator,
+ _GTMValidateContainer(container,
+ validator,
@selector(validateObject:forContainer:));
}
void _GTMValidateContainerContainsMemberOfClass(id container, Class cls) {
GTMMemberOfClassValidator *validator;
validator = [GTMMemberOfClassValidator validateAgainstClass:cls];
- _GTMValidateContainer(container,
- validator,
+ _GTMValidateContainer(container,
+ validator,
@selector(validateObject:forContainer:));
}
void _GTMValidateContainerConformsToProtocol(id container, Protocol* prot) {
GTMConformsToProtocolValidator *validator;
validator = [GTMConformsToProtocolValidator validateAgainstProtocol:prot];
- _GTMValidateContainer(container,
- validator,
+ _GTMValidateContainer(container,
+ validator,
@selector(validateObject:forContainer:));
}
void _GTMValidateContainerItemsRespondToSelector(id container, SEL sel) {
GTMRespondsToSelectorValidator *validator;
validator = [GTMRespondsToSelectorValidator validateAgainstSelector:sel];
- _GTMValidateContainer(container,
- validator,
+ _GTMValidateContainer(container,
+ validator,
@selector(validateObject:forContainer:));
}
@@ -105,21 +105,21 @@ void _GTMValidateContainer(id container, id target, SEL selector) {
NSEnumerator *enumerator = [container objectEnumerator];
id val;
while ((val = [enumerator nextObject])) {
- VerifyObjectWithTargetAndSelectorForContainer(val,
- target,
- selector,
+ VerifyObjectWithTargetAndSelectorForContainer(val,
+ target,
+ selector,
container);
}
} else {
#if GTM_CONTAINERS_VALIDATION_FAILED_ASSERT
- _GTMDevAssert(0, @"container %@ does not respond to -objectEnumerator",
+ _GTMDevAssert(0, @"container %@ does not respond to -objectEnumerator",
[container description]);
#endif // GTM_CONTAINERS_VALIDATION_FAILED_LOG
#if GTM_CONTAINERS_VALIDATION_FAILED_LOG
- _GTMDevLog(@"container does not respont to -objectEnumerator: %@",
+ _GTMDevLog(@"container does not respont to -objectEnumerator: %@",
[container description]);
#endif // GTM_CONTAINERS_VALIDATION_FAILED_LOG
- }
+ }
}
#endif // GTM_CONTAINERS_VALIDATE
@@ -129,12 +129,12 @@ void _GTMValidateContainer(id container, id target, SEL selector) {
return [self validatingArrayWithCapacity:0 target:target selector:sel];
}
-+ (id)validatingArrayWithCapacity:(NSUInteger)capacity
- target:(id)target
++ (id)validatingArrayWithCapacity:(NSUInteger)capacity
+ target:(id)target
selector:(SEL)sel {
- return [[[[self class] alloc] initValidatingWithCapacity:0
- target:target
- selector:sel] autorelease];
+ return [[[self alloc] initValidatingWithCapacity:0
+ target:target
+ selector:sel] autorelease];
}
- (id)initValidatingWithTarget:(id)target selector:(SEL)sel {
@@ -143,7 +143,7 @@ void _GTMValidateContainer(id container, id target, SEL selector) {
#if GTM_CONTAINERS_VALIDATE
- (id)initValidatingWithCapacity:(NSUInteger)capacity
- target:(id)target
+ target:(id)target
selector:(SEL)sel {
if ((self = [super init])) {
embeddedContainer_ = [[NSMutableArray alloc] initWithCapacity:capacity];
@@ -169,14 +169,14 @@ void _GTMValidateContainer(id container, id target, SEL selector) {
}
- (void)addObject:(id)anObject {
- if (VerifyObjectWithTargetAndSelectorForContainer(anObject, target_,
+ if (VerifyObjectWithTargetAndSelectorForContainer(anObject, target_,
selector_, self)) {
[embeddedContainer_ addObject:anObject];
}
}
- (void)insertObject:(id)anObject atIndex:(NSUInteger)idx {
- if (VerifyObjectWithTargetAndSelectorForContainer(anObject, target_,
+ if (VerifyObjectWithTargetAndSelectorForContainer(anObject, target_,
selector_, self)) {
[embeddedContainer_ insertObject:anObject atIndex:idx];
}
@@ -191,21 +191,21 @@ void _GTMValidateContainer(id container, id target, SEL selector) {
}
- (void)replaceObjectAtIndex:(NSUInteger)idx withObject:(id)anObject {
- if (VerifyObjectWithTargetAndSelectorForContainer(anObject, target_,
+ if (VerifyObjectWithTargetAndSelectorForContainer(anObject, target_,
selector_, self)) {
[embeddedContainer_ replaceObjectAtIndex:idx withObject:anObject];
}
}
- (NSString*)description {
- return [NSString stringWithFormat:@"%@ - %@",
+ return [NSString stringWithFormat:@"%@ - %@",
NSStringFromClass([self class]),
[embeddedContainer_ description]];
}
#else // GTM_CONTAINERS_VALIDATE
- (id)initValidatingWithCapacity:(NSUInteger)capacity
- target:(id)target
+ target:(id)target
selector:(SEL)sel {
if ((self = [super init])) {
[self release];
@@ -220,13 +220,13 @@ void _GTMValidateContainer(id container, id target, SEL selector) {
return [self validatingDictionaryWithCapacity:0 target:target selector:sel];
}
-+ (id)validatingDictionaryWithCapacity:(NSUInteger)capacity
- target:(id)target
++ (id)validatingDictionaryWithCapacity:(NSUInteger)capacity
+ target:(id)target
selector:(SEL)sel {
- return [[[[self class] alloc] initValidatingWithCapacity:0
- target:target
- selector:sel] autorelease];
-}
+ return [[[self alloc] initValidatingWithCapacity:0
+ target:target
+ selector:sel] autorelease];
+}
- (id)initValidatingWithTarget:(id)target selector:(SEL)sel {
return [self initValidatingWithCapacity:0 target:target selector:sel];
@@ -234,7 +234,7 @@ void _GTMValidateContainer(id container, id target, SEL selector) {
#if GTM_CONTAINERS_VALIDATE
- (id)initValidatingWithCapacity:(NSUInteger)capacity
- target:(id)target
+ target:(id)target
selector:(SEL)sel {
if ((self = [super init])) {
embeddedContainer_ = [[NSMutableDictionary alloc] initWithCapacity:capacity];
@@ -268,26 +268,26 @@ void _GTMValidateContainer(id container, id target, SEL selector) {
}
- (void)setObject:(id)anObject forKey:(id)aKey {
- if (VerifyObjectWithTargetAndSelectorForContainer(anObject, target_,
+ if (VerifyObjectWithTargetAndSelectorForContainer(anObject, target_,
selector_, self)) {
[embeddedContainer_ setObject:anObject forKey:aKey];
}
}
- (NSString*)description {
- return [NSString stringWithFormat:@"%@ - %@",
+ return [NSString stringWithFormat:@"%@ - %@",
NSStringFromClass([self class]),
[embeddedContainer_ description]];
}
#else // GTM_CONTAINERS_VALIDATE
- (id)initValidatingWithCapacity:(NSUInteger)capacity
- target:(id)target
+ target:(id)target
selector:(SEL)sel {
if ((self = [super init])) {
[self release];
}
- return (GTMValidatingDictionary*)[[NSMutableDictionary alloc]
+ return (GTMValidatingDictionary*)[[NSMutableDictionary alloc]
initWithCapacity:capacity];
}
@@ -299,20 +299,20 @@ void _GTMValidateContainer(id container, id target, SEL selector) {
return [self validatingSetWithCapacity:0 target:target selector:sel];
}
-+ (id)validatingSetWithCapacity:(NSUInteger)capacity
- target:(id)target
++ (id)validatingSetWithCapacity:(NSUInteger)capacity
+ target:(id)target
selector:(SEL)sel {
- return [[[[self class] alloc] initValidatingWithCapacity:0
- target:target
- selector:sel] autorelease];
-}
+ return [[[self alloc] initValidatingWithCapacity:0
+ target:target
+ selector:sel] autorelease];
+}
- (id)initValidatingWithTarget:(id)target selector:(SEL)sel {
return [self initValidatingWithCapacity:0 target:target selector:sel];
}
#if GTM_CONTAINERS_VALIDATE
- (id)initValidatingWithCapacity:(NSUInteger)capacity
- target:(id)target
+ target:(id)target
selector:(SEL)sel {
if ((self = [super init])) {
embeddedContainer_ = [[NSMutableSet alloc] initWithCapacity:capacity];
@@ -342,9 +342,9 @@ void _GTMValidateContainer(id container, id target, SEL selector) {
}
- (void)addObject:(id)object {
- if (object && VerifyObjectWithTargetAndSelectorForContainer(object,
- target_,
- selector_,
+ if (object && VerifyObjectWithTargetAndSelectorForContainer(object,
+ target_,
+ selector_,
self)) {
[embeddedContainer_ addObject:object];
}
@@ -355,14 +355,14 @@ void _GTMValidateContainer(id container, id target, SEL selector) {
}
- (NSString*)description {
- return [NSString stringWithFormat:@"%@ - %@",
+ return [NSString stringWithFormat:@"%@ - %@",
NSStringFromClass([self class]),
[embeddedContainer_ description]];
}
#else // GTM_CONTAINERS_VALIDATE
- (id)initValidatingWithCapacity:(NSUInteger)capacity
- target:(id)target
+ target:(id)target
selector:(SEL)sel {
if ((self = [super init])) {
[self release];
@@ -376,7 +376,7 @@ void _GTMValidateContainer(id container, id target, SEL selector) {
#pragma mark Simple Common Validators
@implementation GTMKindOfClassValidator
+ (id)validateAgainstClass:(Class)cls {
- return [[[[self class] alloc] initWithClass:cls] autorelease];
+ return [[[self alloc] initWithClass:cls] autorelease];
}
- (id)initWithClass:(Class)cls {
@@ -405,7 +405,7 @@ void _GTMValidateContainer(id container, id target, SEL selector) {
@implementation GTMMemberOfClassValidator
+ (id)validateAgainstClass:(Class)cls {
- return [[[[self class] alloc] initWithClass:cls] autorelease];
+ return [[[self alloc] initWithClass:cls] autorelease];
}
- (id)initWithClass:(Class)cls {
@@ -434,7 +434,7 @@ void _GTMValidateContainer(id container, id target, SEL selector) {
@implementation GTMConformsToProtocolValidator
+ (id)validateAgainstProtocol:(Protocol*)prot {
- return [[[[self class] alloc] initWithProtocol:prot] autorelease];
+ return [[[self alloc] initWithProtocol:prot] autorelease];
}
- (id)initWithProtocol:(Protocol*)prot {
@@ -463,7 +463,7 @@ void _GTMValidateContainer(id container, id target, SEL selector) {
@implementation GTMRespondsToSelectorValidator
+ (id)validateAgainstSelector:(SEL)sel {
- return [[[[self class] alloc] initWithSelector:sel] autorelease];
+ return [[[self alloc] initWithSelector:sel] autorelease];
}
- (id)initWithSelector:(SEL)sel {
diff --git a/Foundation/GTMValidatingContainersTest.m b/Foundation/GTMValidatingContainersTest.m
index f9cc377..806ecb0 100644
--- a/Foundation/GTMValidatingContainersTest.m
+++ b/Foundation/GTMValidatingContainersTest.m
@@ -6,9 +6,9 @@
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -39,7 +39,7 @@
@end
@interface GTMVCValidatorTests : GTMVCValidatingTests
-@end
+@end
@interface GTMVCContainerTests : GTMVCValidatingTests {
GTMConformsToProtocolValidator *validator_;
@@ -64,7 +64,7 @@
@implementation GTMVCTestClass
+ (id)instance {
- return [[[[self class] alloc] init] autorelease];
+ return [[[self alloc] init] autorelease];
}
- (NSString*)description {
@@ -115,17 +115,17 @@
GTMKindOfClassValidator *validator;
validator = [GTMKindOfClassValidator validateAgainstClass:nil];
STAssertNil(validator, @"should be nil");
-
+
Class cls = [GTMVCTestClass class];
validator = [GTMKindOfClassValidator validateAgainstClass:cls];
STAssertNotNil(validator, @"should be valid");
-
+
BOOL isGood = [validator validateObject:testClass_ forContainer:nil];
STAssertTrue(isGood, @"should be validated");
-
+
isGood = [validator validateObject:testSubClass_ forContainer:nil];
STAssertTrue(isGood, @"should be validated");
-
+
isGood = [validator validateObject:[NSNumber numberWithInt:0]
forContainer:nil];
STAssertFalse(isGood, @"should fail");
@@ -133,11 +133,11 @@
GTMKindOfClassValidator *validator;
validator = [GTMKindOfClassValidator validateAgainstClass:nil];
STAssertNil(validator, @"should be nil");
-
+
Class cls = [GTMVCTestClass class];
validator = [GTMKindOfClassValidator validateAgainstClass:cls];
STAssertNil(validator, @"should be nil");
-#endif // GTM_CONTAINERS_VALIDATE && GTM_CONTAINERS_VALIDATION_FAILED_LOG && !GTM_CONTAINERS_VALIDATION_FAILED_ASSERT
+#endif // GTM_CONTAINERS_VALIDATE && GTM_CONTAINERS_VALIDATION_FAILED_LOG && !GTM_CONTAINERS_VALIDATION_FAILED_ASSERT
}
- (void)testMemberOfClassValidator {
@@ -146,20 +146,20 @@
GTMMemberOfClassValidator *validator;
validator = [GTMMemberOfClassValidator validateAgainstClass:nil];
STAssertNil(validator, @"should be nil");
-
+
Class cls = [GTMVCTestClass class];
validator = [GTMMemberOfClassValidator validateAgainstClass:cls];
STAssertNotNil(validator, @"should be valid");
-
+
BOOL isGood = [validator validateObject:testClass_ forContainer:nil];
STAssertTrue(isGood, @"should be validated");
-
+
isGood = [validator validateObject:testSubClass_ forContainer:nil];
STAssertFalse(isGood, @"should fail");
-
+
isGood = [validator validateObject:nil forContainer:nil];
STAssertFalse(isGood, @"should fail");
-
+
isGood = [validator validateObject:[NSNumber numberWithInt:0]
forContainer:nil];
STAssertFalse(isGood, @"should fail");
@@ -167,7 +167,7 @@
GTMMemberOfClassValidator *validator;
validator = [GTMMemberOfClassValidator validateAgainstClass:nil];
STAssertNil(validator, @"should be nil");
-
+
Class cls = [GTMVCTestClass class];
validator = [GTMMemberOfClassValidator validateAgainstClass:cls];
STAssertNil(validator, @"should be nil");
@@ -180,24 +180,24 @@
GTMConformsToProtocolValidator *validator;
validator = [GTMConformsToProtocolValidator validateAgainstProtocol:nil];
STAssertNil(validator, @"should be nil");
-
+
Protocol *prot = @protocol(GTMVCTestProtocol);
validator = [GTMConformsToProtocolValidator validateAgainstProtocol:prot];
STAssertNotNil(validator, @"should be valid");
-
+
BOOL isGood = [validator validateObject:testClass_ forContainer:nil];
STAssertFalse(isGood, @"should fail");
-
+
isGood = [validator validateObject:testSubClass_ forContainer:nil];
STAssertTrue(isGood, @"should succeed");
-
+
isGood = [validator validateObject:nil forContainer:nil];
STAssertFalse(isGood, @"should fail");
#else // GTM_CONTAINERS_VALIDATE && GTM_CONTAINERS_VALIDATION_FAILED_LOG && !GTM_CONTAINERS_VALIDATION_FAILED_ASSERT
GTMConformsToProtocolValidator *validator;
validator = [GTMConformsToProtocolValidator validateAgainstProtocol:nil];
STAssertNil(validator, @"should be nil");
-
+
Protocol *prot = @protocol(GTMVCTestProtocol);
validator = [GTMConformsToProtocolValidator validateAgainstProtocol:prot];
STAssertNil(validator, @"should be nil");
@@ -210,24 +210,24 @@
GTMRespondsToSelectorValidator *validator;
validator = [GTMRespondsToSelectorValidator validateAgainstSelector:nil];
STAssertNil(validator, @"should be nil");
-
+
SEL sel = @selector(foo);
validator = [GTMRespondsToSelectorValidator validateAgainstSelector:sel];
STAssertNotNil(validator, @"should be valid");
-
+
BOOL isGood = [validator validateObject:testClass_ forContainer:nil];
STAssertFalse(isGood, @"should fail");
-
+
isGood = [validator validateObject:testSubClass_ forContainer:nil];
STAssertTrue(isGood, @"should succeed");
-
+
isGood = [validator validateObject:nil forContainer:nil];
STAssertFalse(isGood, @"should fail");
#else // GTM_CONTAINERS_VALIDATE && GTM_CONTAINERS_VALIDATION_FAILED_LOG && !GTM_CONTAINERS_VALIDATION_FAILED_ASSERT
GTMRespondsToSelectorValidator *validator;
validator = [GTMRespondsToSelectorValidator validateAgainstSelector:nil];
STAssertNil(validator, @"should be nil");
-
+
SEL sel = @selector(foo);
validator = [GTMRespondsToSelectorValidator validateAgainstSelector:sel];
STAssertNil(validator, @"should be nil");
@@ -243,16 +243,16 @@
array = [GTMValidatingArray validatingArrayWithTarget:validator_
selector:selector_];
STAssertNotNil(array, @"should be valid");
-
+
array = [[[GTMValidatingArray alloc] initValidatingWithTarget:validator_
selector:selector_] autorelease];
STAssertNotNil(array, @"should be valid");
-
+
[GTMUnitTestDevLog expectPattern:@"GTMVCTestClass failed container verification for GTMValidatingArray .*"];
[array addObject:testSubClass_];
[array addObject:testClass_];
STAssertEquals([array objectAtIndex:0], testSubClass_, @"");
-
+
[GTMUnitTestDevLog expectPattern:@"GTMVCTestClass failed container verification for GTMValidatingArray .*"];
[array insertObject:testClass_ atIndex:0];
[array insertObject:testSubClass_ atIndex:0];
@@ -278,21 +278,21 @@
dictionary = [GTMValidatingDictionary validatingDictionaryWithTarget:validator_
selector:selector_];
STAssertNotNil(dictionary, @"should be valid");
-
+
dictionary = [[[GTMValidatingDictionary alloc] initValidatingWithTarget:validator_
selector:selector_] autorelease];
STAssertNotNil(dictionary, @"should be valid");
-
+
[GTMUnitTestDevLog expectPattern:@"GTMVCTestClass failed container verification for GTMValidatingDictionary .*"];
[dictionary setObject:testClass_ forKey:@"Key1"];
[dictionary setObject:testSubClass_ forKey:@"Key2"];
STAssertEquals([dictionary objectForKey:@"Key2"], testSubClass_, @"");
STAssertNotNil([dictionary keyEnumerator], @"");
-
+
[dictionary removeObjectForKey:@"Key2"];
[dictionary removeObjectForKey:@"Key1"];
STAssertEquals([dictionary count], (NSUInteger)0, @"should have no objects left");
-
+
// So we get full code coverage
[testSubClass_ foo];
#if !(GTM_CONTAINERS_VALIDATE && GTM_CONTAINERS_VALIDATION_FAILED_LOG && !GTM_CONTAINERS_VALIDATION_FAILED_ASSERT)
@@ -308,17 +308,17 @@
set = [GTMValidatingSet validatingSetWithTarget:validator_
selector:selector_];
STAssertNotNil(set, @"should be valid");
-
+
set = [[[GTMValidatingSet alloc] initValidatingWithTarget:validator_
selector:selector_] autorelease];
STAssertNotNil(set, @"should be valid");
-
+
[GTMUnitTestDevLog expectPattern:@"GTMVCTestClass failed container verification for GTMValidatingSet .*"];
[set addObject:testClass_];
[set addObject:testSubClass_];
STAssertEqualObjects([set member:testSubClass_], testSubClass_, @"");
STAssertNotNil([set objectEnumerator], @"");
-
+
[set removeObject:testClass_];
[set removeObject:testSubClass_];
#if !(GTM_CONTAINERS_VALIDATE && GTM_CONTAINERS_VALIDATION_FAILED_LOG && !GTM_CONTAINERS_VALIDATION_FAILED_ASSERT)
@@ -339,36 +339,36 @@
[GTMVCTestClass instance], @"key1",
[GTMVCTestSubClass instance], @"key2",
nil];
-
+
// Test bad container
[GTMUnitTestDevLog expectPattern:@"container does not respont to -objectEnumerator: .*"];
- _GTMValidateContainerContainsKindOfClass([NSString string],
+ _GTMValidateContainerContainsKindOfClass([NSString string],
[GTMVCTestSubClass class]);
-
- _GTMValidateContainerContainsKindOfClass(homogenousDict,
+
+ _GTMValidateContainerContainsKindOfClass(homogenousDict,
[GTMVCTestSubClass class]);
- _GTMValidateContainerContainsKindOfClass(heterogenousDict,
+ _GTMValidateContainerContainsKindOfClass(heterogenousDict,
[GTMVCTestClass class]);
[GTMUnitTestDevLog expectPattern:@"GTMVCTestClass failed container verification for .*"];
- _GTMValidateContainerContainsKindOfClass(heterogenousDict,
+ _GTMValidateContainerContainsKindOfClass(heterogenousDict,
[GTMVCTestSubClass class]);
- _GTMValidateContainerContainsMemberOfClass(homogenousDict,
+ _GTMValidateContainerContainsMemberOfClass(homogenousDict,
[GTMVCTestSubClass class]);
[GTMUnitTestDevLog expectPattern:@"GTMVCTestSubClass failed container verification for .*"];
- _GTMValidateContainerContainsMemberOfClass(heterogenousDict,
+ _GTMValidateContainerContainsMemberOfClass(heterogenousDict,
[GTMVCTestClass class]);
- _GTMValidateContainerConformsToProtocol(homogenousDict,
+ _GTMValidateContainerConformsToProtocol(homogenousDict,
@protocol(GTMVCTestProtocol));
[GTMUnitTestDevLog expectPattern:@"GTMVCTestClass failed container verification for .*"];
- _GTMValidateContainerConformsToProtocol(heterogenousDict,
+ _GTMValidateContainerConformsToProtocol(heterogenousDict,
@protocol(GTMVCTestProtocol));
- _GTMValidateContainerItemsRespondToSelector(homogenousDict,
+ _GTMValidateContainerItemsRespondToSelector(homogenousDict,
@selector(foo));
[GTMUnitTestDevLog expectPattern:@"GTMVCTestClass failed container verification for .*"];
- _GTMValidateContainerItemsRespondToSelector(heterogenousDict,
+ _GTMValidateContainerItemsRespondToSelector(heterogenousDict,
@selector(foo));
#if !(GTM_CONTAINERS_VALIDATE && GTM_CONTAINERS_VALIDATION_FAILED_LOG && !GTM_CONTAINERS_VALIDATION_FAILED_ASSERT)
// If we're not validating, we don't expect any logs