mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Make test work when GS_GENERIC_CLASS is not defined.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39495 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2084f2f49b
commit
ecd0657dee
1 changed files with 11 additions and 10 deletions
|
@ -109,16 +109,17 @@ testBlock(NSDictionary* dict)
|
|||
NSPredicate *p = nil;
|
||||
NSPredicate *p2 = nil;
|
||||
# if __has_feature(blocks)
|
||||
p = [NSPredicate predicateWithBlock: ^BOOL(id obj,
|
||||
GS_GENERIC_CLASS(NSDictionary,NSString*,id)* bindings){
|
||||
NSString *key = [bindings objectForKey: @"Key"];
|
||||
if (nil == key)
|
||||
{
|
||||
key = @"Record1";
|
||||
}
|
||||
NSString *value = [[obj objectForKey: key] objectForKey: @"Name"];
|
||||
return [value isEqualToString: @"John"];
|
||||
}];
|
||||
p = [NSPredicate predicateWithBlock: ^BOOL(id obj, NSDictionary *bindings)
|
||||
{
|
||||
NSString *key = [bindings objectForKey: @"Key"];
|
||||
|
||||
if (nil == key)
|
||||
{
|
||||
key = @"Record1";
|
||||
}
|
||||
NSString *value = [[obj objectForKey: key] objectForKey: @"Name"];
|
||||
return [value isEqualToString: @"John"];
|
||||
}];
|
||||
PASS([p evaluateWithObject: dict], "BLOCKPREDICATE() without bindings");
|
||||
p2 = [p predicateWithSubstitutionVariables:
|
||||
[NSDictionary dictionaryWithObjectsAndKeys: @"Record2", @"Key", nil]];
|
||||
|
|
Loading…
Reference in a new issue