@@ -27,7 +27,8 @@ class TestNSArray : XCTestCase {
27
27
( " test_enumeration " , test_enumeration) ,
28
28
( " test_sequenceType " , test_sequenceType) ,
29
29
( " test_getObjects " , test_getObjects) ,
30
- ( " test_binarySearch " , test_binarySearch)
30
+ ( " test_binarySearch " , test_binarySearch) ,
31
+ ( " test_replaceObjectsInRange_withObjectsFromArray " , test_replaceObjectsInRange_withObjectsFromArray) ,
31
32
]
32
33
}
33
34
@@ -148,4 +149,23 @@ class TestNSArray : XCTestCase {
148
149
149
150
return . OrderedDescending
150
151
}
152
+
153
+ func test_replaceObjectsInRange_withObjectsFromArray( ) {
154
+ let array1 = NSMutableArray ( array: [
155
+ " foo1 " . bridge ( ) ,
156
+ " bar1 " . bridge ( ) ,
157
+ " baz1 " . bridge ( ) ] )
158
+
159
+ let array2 : [ AnyObject ] = [
160
+ " foo2 " . bridge ( ) ,
161
+ " bar2 " . bridge ( ) ,
162
+ " baz2 " . bridge ( ) ]
163
+
164
+ array1. replaceObjectsInRange ( NSMakeRange ( 0 , 2 ) , withObjectsFromArray: array2)
165
+
166
+ XCTAssertEqual ( array1 [ 0 ] as? NSString , " foo2 " . bridge ( ) , " Expected foo2 but was \( array1 [ 0 ] ) " )
167
+ XCTAssertEqual ( array1 [ 1 ] as? NSString , " bar2 " . bridge ( ) , " Expected bar2 but was \( array1 [ 1 ] ) " )
168
+ XCTAssertEqual ( array1 [ 2 ] as? NSString , " baz2 " . bridge ( ) , " Expected baz2 but was \( array1 [ 2 ] ) " )
169
+ XCTAssertEqual ( array1 [ 3 ] as? NSString , " baz1 " . bridge ( ) , " Expected baz1 but was \( array1 [ 3 ] ) " )
170
+ }
151
171
}
0 commit comments