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:
Richard Frith-MacDonald 2016-03-09 13:35:20 +00:00
parent 2084f2f49b
commit ecd0657dee

View file

@ -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]];