From 02207d13db9a386316101a722cdf143ba2090e71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Fri, 22 Nov 2024 00:46:29 +0100 Subject: [PATCH] Fix deprecation warnings in SortedArray tests --- Tests/HandySwiftTests/Structs/SortedArrayTests.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Tests/HandySwiftTests/Structs/SortedArrayTests.swift b/Tests/HandySwiftTests/Structs/SortedArrayTests.swift index fe9624c..2d2db9d 100644 --- a/Tests/HandySwiftTests/Structs/SortedArrayTests.swift +++ b/Tests/HandySwiftTests/Structs/SortedArrayTests.swift @@ -13,13 +13,13 @@ class SortedArrayTests: XCTestCase { let emptyArray: [Int] = [] let sortedEmptyArray = SortedArray(emptyArray) - XCTAssertNil(sortedEmptyArray.index { _ in true }) + XCTAssertNil(sortedEmptyArray.firstIndex { _ in true }) let intArray: [Int] = [5, 6, 7, 8, 9, 0, 1, 2, 3, 4] let sortedIntArray = SortedArray(intArray) let expectedIndex = 3 - let resultingIndex = sortedIntArray.index { $0 >= 3 } + let resultingIndex = sortedIntArray.firstIndex { $0 >= 3 } XCTAssertEqual(resultingIndex, expectedIndex) } @@ -28,7 +28,7 @@ class SortedArrayTests: XCTestCase { let intArray: [Int] = [5, 6, 7, 8, 9, 0, 1, 2, 3, 4] let sortedIntArray = SortedArray(intArray) - let index = sortedIntArray.index { $0 > 5 }! + let index = sortedIntArray.firstIndex { $0 > 5 }! let sortedSubArray = sortedIntArray.prefix(upTo: index) XCTAssertEqual(sortedSubArray.array, [0, 1, 2, 3, 4, 5]) @@ -38,7 +38,7 @@ class SortedArrayTests: XCTestCase { let intArray: [Int] = [5, 6, 7, 8, 9, 0, 1, 2, 3, 4] let sortedIntArray = SortedArray(intArray) - let index = sortedIntArray.index { $0 > 5 }! + let index = sortedIntArray.firstIndex { $0 > 5 }! let sortedSubArray = sortedIntArray.suffix(from: index) XCTAssertEqual(sortedSubArray.array, [6, 7, 8, 9])