File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,6 +22,20 @@ describe(module.id, function () {
2222 expect ( res [ 0 ] . constructor . name ) . toEqual ( "NSURL" ) ;
2323 } ) ;
2424
25+ it ( "indexed access works for non-NSArray indexable collections" , function ( ) {
26+ // NSOrderedSet is not an NSArray but responds to count + objectAtIndex:,
27+ // so obj[i] should resolve the same elements as objectAtIndex(i).
28+ const set = NSOrderedSet . orderedSetWithArray ( [ 'a' , 'b' , 'c' ] ) ;
29+ expect ( set . count ) . toBe ( 3 ) ;
30+ expect ( set [ 0 ] ) . toBe ( set . objectAtIndex ( 0 ) ) ;
31+ expect ( set [ 1 ] ) . toBe ( set . objectAtIndex ( 1 ) ) ;
32+ expect ( set [ 2 ] ) . toBe ( set . objectAtIndex ( 2 ) ) ;
33+ expect ( set [ 0 ] ) . toBe ( 'a' ) ;
34+ expect ( set [ 2 ] ) . toBe ( 'c' ) ;
35+ // Out-of-range index returns undefined instead of throwing.
36+ expect ( set [ 3 ] ) . toBeUndefined ( ) ;
37+ } ) ;
38+
2539 it ( "MethodCalledInDealloc" , function ( ) {
2640 expect ( function ( ) {
2741 ( function ( ) {
You can’t perform that action at this time.
0 commit comments