mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Replace NSArray subscripting with traditional method call
This commit is contained in:
parent
cb05d93167
commit
153fe3f7f0
1 changed files with 4 additions and 1 deletions
|
@ -8,6 +8,7 @@ int main(void) {
|
|||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
NSDictionary *dict1, *dict2;
|
||||
NSArray *array, *filtered;
|
||||
NSString *value;
|
||||
NSPredicate *predicate;
|
||||
|
||||
dict1 = [NSDictionary dictionaryWithObject:@"value1" forKey:@"key"];
|
||||
|
@ -18,7 +19,9 @@ int main(void) {
|
|||
predicate = [NSPredicate predicateWithFormat:@"key == %@", @"value2"];
|
||||
filtered = [array filteredArrayUsingPredicate: predicate];
|
||||
|
||||
PASS(filtered.count == 1 && [filtered[0][@"key"] isEqualToString:@"value2"],
|
||||
value = [[filtered objectAtIndex:0] objectForKey:@"key"];
|
||||
|
||||
PASS(filtered.count == 1 && [value isEqualToString:@"value2"],
|
||||
"NSPredicate should correctly filter array including NSNull");
|
||||
|
||||
// Filtering with NSPredicate where no match is found
|
||||
|
|
Loading…
Reference in a new issue