mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-05 16:42:58 +00:00
Merge pull request #1598 from slevenbits/array-filters-fix
Fixed the method names committed in 0f5a6b4e5e
This commit is contained in:
commit
e444a5d60a
2 files changed
+27
-27
No files matched your search
@@ -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.
|
||||
|
||||
@@ -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_
|
||||
|
||||
Reference in new issue
Block a user