Skip to content

Commit

Permalink
Replace NSArray subscripting with traditional method call
Browse files Browse the repository at this point in the history
  • Loading branch information
hmelder committed Dec 28, 2023
1 parent cb05d93 commit 153fe3f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Tests/base/NSPredicate/nsnull.m
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand All @@ -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
Expand Down

0 comments on commit 153fe3f

Please sign in to comment.