Support for collection subscripting (NSArray and NSDictionary).

Yes, the syntax is ugly, but no doubt people will start using it in June...



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35033 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Chisnall 2012-04-06 12:23:10 +00:00
parent 099038ac58
commit 3cb1b08b26
7 changed files with 64 additions and 4 deletions

View file

@ -2,6 +2,7 @@
#import "ObjectTesting.h"
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSValue.h>
#import <Foundation/NSString.h>
int main()
@ -27,6 +28,19 @@ int main()
test_NSCoding(testObjs);
test_NSCopying(@"NSDictionary", @"NSMutableDictionary", testObjs, YES, NO);
test_NSMutableCopying(@"NSDictionary", @"NSMutableDictionary", testObjs);
START_SET("NSArray subscripting")
# ifndef __has_feature
# define __has_feature(x) 0
# endif
#if __has_feature(objc_subscripting)
NSDictionary *dictionary = @{@123 : @123.4 ,
@"date" : @"today" };
PASS([dictionary[@123] isEqual: @123.4], "Dictionary subscripting works");
# else
SKIP("No dictionary subscripting support in the compiler.")
# endif
END_SET("NSDictionary subscripting")
[arp release]; arp = nil;
return 0;