mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-07 09:28:02 +00:00
Merge pull request #2409 from primalmotion/predicate-fix
FIXED: CPPredicate's predicateFormat with a CPNull value as right exp…
This commit is contained in:
commit
678f4fca8a
2 files changed
+14
No files matched your search
@@ -66,6 +66,9 @@
|
||||
if ([_value isKindOfClass:[CPString class]])
|
||||
return @"\"" + _value + @"\"";
|
||||
|
||||
if (_value === [CPNull null])
|
||||
return @"nil";
|
||||
|
||||
return [_value description];
|
||||
}
|
||||
|
||||
|
||||
@@ -577,6 +577,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)testPredicateFormatWithNullGeneratesCorrectString
|
||||
{
|
||||
var predicate1 = [CPPredicate predicateWithFormat:@"value == %@", [CPNull null]],
|
||||
predicate2 = [CPPredicate predicateWithFormat:@"value == null"],
|
||||
predicate3 = [CPPredicate predicateWithFormat:@"value == nil"];
|
||||
|
||||
[self assert:[predicate1 predicateFormat] equals:@"value == nil"];
|
||||
[self assert:[predicate2 predicateFormat] equals:@"value == nil"];
|
||||
[self assert:[predicate3 predicateFormat] equals:@"value == nil"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPObject (PredicateTesting)
|
||||
|
||||
Reference in new issue
Block a user