| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6a354f8 commit 530c40c
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,6 +22,20 @@ describe(module.id, function () { | |||
| 22 | 22 | expect(res[0].constructor.name).toEqual("NSURL"); | |
| 23 | 23 | }); | |
| 24 | 24 | ||
| 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 | + | ||
| 25 | 39 | it("MethodCalledInDealloc", function () { | |
| 26 | 40 | expect(function () { | |
| 27 | 41 | (function () { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments