Skip to content

Commit b7372f2

Browse files
committed
Add a test for NSArray.getObjects
1 parent 74bf59e commit b7372f2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

TestFoundation/TestNSArray.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class TestNSArray : XCTestCase {
2626
("test_BasicConstruction", test_BasicConstruction),
2727
("test_enumeration", test_enumeration),
2828
("test_sequenceType", test_sequenceType),
29+
("test_getObjects", test_getObjects),
2930
]
3031
}
3132

@@ -70,4 +71,17 @@ class TestNSArray : XCTestCase {
7071
XCTAssertEqual(res, ["foo", "bar", "baz"])
7172
}
7273

74+
func test_getObjects() {
75+
let array : NSArray = ["foo", "bar", "baz", "foo1", "bar2", "baz3",].bridge()
76+
var objects = [AnyObject]()
77+
array.getObjects(&objects, range: NSMakeRange(1, 3))
78+
XCTAssertEqual(objects.count, 3)
79+
let fetched = [
80+
(objects[0] as! NSString).bridge(),
81+
(objects[1] as! NSString).bridge(),
82+
(objects[2] as! NSString).bridge(),
83+
]
84+
XCTAssertEqual(fetched, ["bar", "baz", "foo1"])
85+
}
86+
7387
}

0 commit comments

Comments
 (0)