Skip to content

Commit 02207d1

Browse files
committed
Fix deprecation warnings in SortedArray tests
1 parent 89ba73d commit 02207d1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Tests/HandySwiftTests/Structs/SortedArrayTests.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ class SortedArrayTests: XCTestCase {
1313
let emptyArray: [Int] = []
1414
let sortedEmptyArray = SortedArray(emptyArray)
1515

16-
XCTAssertNil(sortedEmptyArray.index { _ in true })
16+
XCTAssertNil(sortedEmptyArray.firstIndex { _ in true })
1717

1818
let intArray: [Int] = [5, 6, 7, 8, 9, 0, 1, 2, 3, 4]
1919
let sortedIntArray = SortedArray(intArray)
2020

2121
let expectedIndex = 3
22-
let resultingIndex = sortedIntArray.index { $0 >= 3 }
22+
let resultingIndex = sortedIntArray.firstIndex { $0 >= 3 }
2323

2424
XCTAssertEqual(resultingIndex, expectedIndex)
2525
}
@@ -28,7 +28,7 @@ class SortedArrayTests: XCTestCase {
2828
let intArray: [Int] = [5, 6, 7, 8, 9, 0, 1, 2, 3, 4]
2929
let sortedIntArray = SortedArray(intArray)
3030

31-
let index = sortedIntArray.index { $0 > 5 }!
31+
let index = sortedIntArray.firstIndex { $0 > 5 }!
3232
let sortedSubArray = sortedIntArray.prefix(upTo: index)
3333

3434
XCTAssertEqual(sortedSubArray.array, [0, 1, 2, 3, 4, 5])
@@ -38,7 +38,7 @@ class SortedArrayTests: XCTestCase {
3838
let intArray: [Int] = [5, 6, 7, 8, 9, 0, 1, 2, 3, 4]
3939
let sortedIntArray = SortedArray(intArray)
4040

41-
let index = sortedIntArray.index { $0 > 5 }!
41+
let index = sortedIntArray.firstIndex { $0 > 5 }!
4242
let sortedSubArray = sortedIntArray.suffix(from: index)
4343

4444
XCTAssertEqual(sortedSubArray.array, [6, 7, 8, 9])

0 commit comments

Comments
 (0)