mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-20 09:20:41 +00:00
Merge branch 'master' of https://github.com/cappuccino/cappuccino
This commit is contained in:
@@ -190,13 +190,18 @@
|
||||
if (self === anObject)
|
||||
return YES;
|
||||
|
||||
if (self.isa !== anObject.isa || _value !== [anObject evaluateObject:nil])
|
||||
if (self.isa !== anObject.isa || _value !== [anObject evaluateWithObject:nil])
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)evaluateObject:(id)object
|
||||
- (BOOL)evaluateWithObject:(id)object
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
- (BOOL)evaluateWithObject:(id)object substitutionVariables:(CPDictionary)variables
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
@@ -450,6 +450,23 @@
|
||||
[self assertTrue:([filtered count] == 2) message:@"Count should be 2 and is " + [filtered count]];
|
||||
}
|
||||
|
||||
- (void)testTruepredicate
|
||||
{
|
||||
var data = [1, 2, 3],
|
||||
result;
|
||||
|
||||
var tpred = [CPPredicate predicateWithFormat:@"TRUEPREDICATE"];
|
||||
var ctpred = [CPCompoundPredicate andPredicateWithSubpredicates:[tpred]];
|
||||
|
||||
// fails if evaluateWithObject: isn't implemented in CPPredicate_BOOL
|
||||
result = [tpred evaluateWithObject:"gazonk"];
|
||||
[self assertTrue:result message:"'" + [tpred description] + "' should evaluate to true"];
|
||||
|
||||
// fails if evaluateWithObject:substitutionVariables: isn't implemented in CPPredicate_BOOL
|
||||
result = [data filteredArrayUsingPredicate:ctpred];
|
||||
[self assertTrue:[result isEqual:data] message:"[1, 2, 3] filtered with '" + [ctpred description] + "' should return [1, 2, 3]"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPObject (PredicateTesting)
|
||||
|
||||
Reference in New Issue
Block a user