From 593f3c2109a147c243b023face70ab0f62b9b046 Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Wed, 4 Jul 2012 17:03:53 -0400 Subject: [PATCH] Fixed the method names --- Foundation/CPArray/CPArray.j | 14 ++++++------ Tests/Foundation/CPArrayTest.j | 40 +++++++++++++++++----------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Foundation/CPArray/CPArray.j b/Foundation/CPArray/CPArray.j index 8a2dd673c..8a40866e1 100755 --- a/Foundation/CPArray/CPArray.j +++ b/Foundation/CPArray/CPArray.j @@ -491,9 +491,9 @@ var concat = Array.prototype.concat, or nil to stop the search, which will return \c CPNotFound to the sender. @return A CPIndexSet of the matching object indexes. */ -- (CPIndexSet)indexesOfObjectPassingTest:(Function)aPredicate +- (CPIndexSet)indexesOfObjectsPassingTest:(Function)aPredicate { - return [self indexesOfObjectWithOptions:CPEnumerationNormal passingTest:aPredicate context:undefined]; + return [self indexesOfObjectsWithOptions:CPEnumerationNormal passingTest:aPredicate context:undefined]; } /*! @@ -505,9 +505,9 @@ var concat = Array.prototype.concat, @param context An object that contains context information you want passed to the predicate function. @return A CPIndexSet of the matching object indexes. */ -- (CPIndexSet)indexesOfObjectPassingTest:(Function)aPredicate context:(id)aContext +- (CPIndexSet)indexesOfObjectsPassingTest:(Function)aPredicate context:(id)aContext { - return [self indexesOfObjectWithOptions:CPEnumerationNormal passingTest:aPredicate context:aContext]; + return [self indexesOfObjectsWithOptions:CPEnumerationNormal passingTest:aPredicate context:aContext]; } /*! @@ -520,9 +520,9 @@ var concat = Array.prototype.concat, or nil to stop the search, which will return CPNotFound to the sender. @return A CPIndexSet of the matching object indexes. */ -- (CPIndexSet)indexesOfObjectWithOptions:(CPEnumerationOptions)options passingTest:(Function)aPredicate +- (CPIndexSet)indexesOfObjectsWithOptions:(CPEnumerationOptions)options passingTest:(Function)aPredicate { - return [self indexesOfObjectWithOptions:options passingTest:aPredicate context:undefined]; + return [self indexesOfObjectsWithOptions:options passingTest:aPredicate context:undefined]; } /*! @@ -536,7 +536,7 @@ var concat = Array.prototype.concat, @param context An object that contains context information you want passed to the predicate function. @return A CPIndexSet of the matching object indexes. */ -- (CPIndexSet)indexesOfObjectWithOptions:(CPEnumerationOptions)options passingTest:(Function)aPredicate context:(id)aContext +- (CPIndexSet)indexesOfObjectsWithOptions:(CPEnumerationOptions)options passingTest:(Function)aPredicate context:(id)aContext { // We don't use an enumerator because they return nil to indicate end of enumeration, // but nil may actually be the value we are looking for, so we have to loop over the array. diff --git a/Tests/Foundation/CPArrayTest.j b/Tests/Foundation/CPArrayTest.j index 248df12e5..df51505f4 100644 --- a/Tests/Foundation/CPArrayTest.j +++ b/Tests/Foundation/CPArrayTest.j @@ -356,7 +356,7 @@ } -- (void)test_indexesOfObjectPassingTest_ +- (void)test_indexesOfObjectsPassingTest_ { var array = [[[self class] arrayClass] arrayWithObjects: { name:@"Tom", age:7 }, @@ -364,11 +364,11 @@ { name:@"Harry", age:27 }, { name:@"Zelda", age:7 }]; - [self assert:[array indexesOfObjectPassingTest:function() { return YES; }] equals:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, 4)]]; - [self assert:[array indexesOfObjectPassingTest:function() { return NO; }] equals:[CPIndexSet indexSet]]; - [self assert:[array indexesOfObjectPassingTest:function() { return nil; }] equals:[CPIndexSet indexSet]]; + [self assert:[array indexesOfObjectsPassingTest:function() { return YES; }] equals:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, 4)]]; + [self assert:[array indexesOfObjectsPassingTest:function() { return NO; }] equals:[CPIndexSet indexSet]]; + [self assert:[array indexesOfObjectsPassingTest:function() { return nil; }] equals:[CPIndexSet indexSet]]; - [self assert:[array indexesOfObjectPassingTest:function(anObject, anIndex) + [self assert:[array indexesOfObjectsPassingTest:function(anObject, anIndex) { return [anObject.name isEqual:@"Harry"]; }] equals:[CPIndexSet indexSetWithIndex:2]]; @@ -376,18 +376,18 @@ var indexSet = [CPIndexSet indexSetWithIndex:0]; [indexSet addIndex:3]; - [self assert:[array indexesOfObjectPassingTest:function(anObject, anIndex) + [self assert:[array indexesOfObjectsPassingTest:function(anObject, anIndex) { return anObject.age === 7; }] equals:indexSet]; - [self assert:[array indexesOfObjectPassingTest:function(anObject, anIndex) + [self assert:[array indexesOfObjectsPassingTest:function(anObject, anIndex) { return [anObject.name isEqual:@"Horton"]; }] equals:[CPIndexSet indexSet]]; } -- (void)test_indexesOfObjectPassingTest_context_ +- (void)test_indexesOfObjectsPassingTest_context_ { var array = [[[self class] arrayClass] arrayWithObjects: { name:@"Tom", age:7 }, @@ -395,7 +395,7 @@ { name:@"Harry", age:27 }, { name:@"Zelda", age:7 }]; - [self assert:[array indexesOfObjectPassingTest:function(anObject, anIndex, aContext) + [self assert:[array indexesOfObjectsPassingTest:function(anObject, anIndex, aContext) { return [anObject.name isEqual:aContext]; } context:@"Harry"] equals:[CPIndexSet indexSetWithIndex:2]]; @@ -403,13 +403,13 @@ var indexSet = [CPIndexSet indexSetWithIndex:0]; [indexSet addIndex:3]; - [self assert:[array indexesOfObjectPassingTest:function(anObject, anIndex, aContext) + [self assert:[array indexesOfObjectsPassingTest:function(anObject, anIndex, aContext) { return anObject.age === aContext; } context:7] equals:indexSet]; } -- (void)test_indexesOfObjectWithOptions_passingTest +- (void)test_indexesOfObjectsWithOptions_passingTest { var array = [[[self class] arrayClass] arrayWithObjects: { name:@"Tom", age:7 }, @@ -425,17 +425,17 @@ return anObject.age === 7; }; - [self assert:[array indexesOfObjectWithOptions:CPEnumerationNormal passingTest:namePredicate] equals:[CPIndexSet indexSetWithIndex:2]]; - [self assert:[array indexesOfObjectWithOptions:CPEnumerationReverse passingTest:namePredicate] equals:[CPIndexSet indexSetWithIndex:2]]; + [self assert:[array indexesOfObjectsWithOptions:CPEnumerationNormal passingTest:namePredicate] equals:[CPIndexSet indexSetWithIndex:2]]; + [self assert:[array indexesOfObjectsWithOptions:CPEnumerationReverse passingTest:namePredicate] equals:[CPIndexSet indexSetWithIndex:2]]; var indexSet = [CPIndexSet indexSetWithIndex:0]; [indexSet addIndex:3]; - [self assert:[array indexesOfObjectWithOptions:CPEnumerationNormal passingTest:agePredicate] equals:indexSet]; - [self assert:[array indexesOfObjectWithOptions:CPEnumerationReverse passingTest:agePredicate] equals:indexSet]; + [self assert:[array indexesOfObjectsWithOptions:CPEnumerationNormal passingTest:agePredicate] equals:indexSet]; + [self assert:[array indexesOfObjectsWithOptions:CPEnumerationReverse passingTest:agePredicate] equals:indexSet]; } -- (void)test_indexesOfObjectWithOptions_passingTest_context +- (void)test_indexesOfObjectsWithOptions_passingTest_context { var array = [[[self class] arrayClass] arrayWithObjects: { name:@"Tom", age:7 }, @@ -451,14 +451,14 @@ return anObject.age === aContext; }; - [self assert:[array indexesOfObjectWithOptions:CPEnumerationNormal passingTest:namePredicate context:@"Harry"] equals:[CPIndexSet indexSetWithIndex:2]]; - [self assert:[array indexesOfObjectWithOptions:CPEnumerationReverse passingTest:namePredicate context:@"Harry"] equals:[CPIndexSet indexSetWithIndex:2]]; + [self assert:[array indexesOfObjectsWithOptions:CPEnumerationNormal passingTest:namePredicate context:@"Harry"] equals:[CPIndexSet indexSetWithIndex:2]]; + [self assert:[array indexesOfObjectsWithOptions:CPEnumerationReverse passingTest:namePredicate context:@"Harry"] equals:[CPIndexSet indexSetWithIndex:2]]; var indexSet = [CPIndexSet indexSetWithIndex:0]; [indexSet addIndex:3]; - [self assert:[array indexesOfObjectWithOptions:CPEnumerationNormal passingTest:agePredicate context:7] equals:indexSet]; - [self assert:[array indexesOfObjectWithOptions:CPEnumerationReverse passingTest:agePredicate context:7] equals:indexSet]; + [self assert:[array indexesOfObjectsWithOptions:CPEnumerationNormal passingTest:agePredicate context:7] equals:indexSet]; + [self assert:[array indexesOfObjectsWithOptions:CPEnumerationReverse passingTest:agePredicate context:7] equals:indexSet]; } - (void)test_isEqualToArray_