diff options
| author | Bug Magnet <marco.nikic@mullvad.net> | 2024-12-04 14:43:23 +0100 |
|---|---|---|
| committer | Bug Magnet <marco.nikic@mullvad.net> | 2025-01-14 10:18:06 +0100 |
| commit | d1cf679456f87b2f93b150c67a76fa20e31d7643 (patch) | |
| tree | 6ae6911848db62013e09939488a54fd98bad81b4 /ios/OperationsTests | |
| parent | d2949b4a0b1d3d86a25de1569dc8308c9d7fe237 (diff) | |
| download | mullvadvpn-d1cf679456f87b2f93b150c67a76fa20e31d7643.tar.xz mullvadvpn-d1cf679456f87b2f93b150c67a76fa20e31d7643.zip | |
Enable compilation with Swift 6 for most targets
Diffstat (limited to 'ios/OperationsTests')
| -rw-r--r-- | ios/OperationsTests/AsyncBlockOperationTests.swift | 20 | ||||
| -rw-r--r-- | ios/OperationsTests/AsyncResultBlockOperationTests.swift | 12 | ||||
| -rw-r--r-- | ios/OperationsTests/OperationConditionTests.swift | 1 |
3 files changed, 17 insertions, 16 deletions
diff --git a/ios/OperationsTests/AsyncBlockOperationTests.swift b/ios/OperationsTests/AsyncBlockOperationTests.swift index c19e5e8a3f..00a7796f1c 100644 --- a/ios/OperationsTests/AsyncBlockOperationTests.swift +++ b/ios/OperationsTests/AsyncBlockOperationTests.swift @@ -14,7 +14,7 @@ import XCTest final class AsyncBlockOperationTests: XCTestCase { let operationQueue = AsyncOperationQueue() - func testBlockOperation() { + func testBlockOperation() async { let executionExpectation = expectation(description: "Should execute") let finishExpectation = expectation(description: "Should finish") @@ -29,10 +29,10 @@ final class AsyncBlockOperationTests: XCTestCase { operationQueue.addOperation(operation) - waitForExpectations(timeout: .UnitTest.timeout) + await fulfillment(of: [executionExpectation, finishExpectation], timeout: .UnitTest.timeout) } - func testSynchronousBlockOperation() { + func testSynchronousBlockOperation() async { let executionExpectation = expectation(description: "Should execute") let finishExpectation = expectation(description: "Should finish") @@ -46,10 +46,10 @@ final class AsyncBlockOperationTests: XCTestCase { operationQueue.addOperation(operation) - waitForExpectations(timeout: .UnitTest.timeout) + await fulfillment(of: [executionExpectation, finishExpectation], timeout: .UnitTest.timeout) } - func testCancellableTaskBlockOperation() { + func testCancellableTaskBlockOperation() async { let executionExpectation = expectation(description: "Should execute") let cancelExpectation = expectation(description: "Should cancel") let finishExpectation = expectation(description: "Should finish") @@ -73,10 +73,10 @@ final class AsyncBlockOperationTests: XCTestCase { operationQueue.addOperation(operation) - waitForExpectations(timeout: .UnitTest.timeout) + await fulfillment(of: [executionExpectation, cancelExpectation, finishExpectation], timeout: .UnitTest.timeout) } - func testCancellationShouldNotFireBeforeOperationIsEnqueued() throws { + func testCancellationShouldNotFireBeforeOperationIsEnqueued() async throws { let expect = expectation(description: "Cancellation should not fire.") expect.isInverted = true @@ -84,10 +84,10 @@ final class AsyncBlockOperationTests: XCTestCase { operation.onCancel { _ in expect.fulfill() } operation.cancel() - waitForExpectations(timeout: .UnitTest.invertedTimeout) + await fulfillment(of: [expect], timeout: .UnitTest.invertedTimeout) } - func testCancellationShouldFireAfterCancelledOperationIsEnqueued() throws { + func testCancellationShouldFireAfterCancelledOperationIsEnqueued() async throws { let expect = expectation(description: "Cancellation should fire.") let operation = AsyncBlockOperation {} @@ -95,6 +95,6 @@ final class AsyncBlockOperationTests: XCTestCase { operation.cancel() operationQueue.addOperation(operation) - waitForExpectations(timeout: .UnitTest.timeout) + await fulfillment(of: [expect], timeout: .UnitTest.timeout) } } diff --git a/ios/OperationsTests/AsyncResultBlockOperationTests.swift b/ios/OperationsTests/AsyncResultBlockOperationTests.swift index 0cccf93241..9cb669e87b 100644 --- a/ios/OperationsTests/AsyncResultBlockOperationTests.swift +++ b/ios/OperationsTests/AsyncResultBlockOperationTests.swift @@ -14,7 +14,7 @@ import XCTest final class AsyncResultBlockOperationTests: XCTestCase { let operationQueue = AsyncOperationQueue() - func testBlockOperation() { + func testBlockOperation() async { let expectation = expectation(description: "Should finish") let operation = ResultBlockOperation<Bool> { finish in @@ -28,10 +28,10 @@ final class AsyncResultBlockOperationTests: XCTestCase { operationQueue.addOperation(operation) - waitForExpectations(timeout: .UnitTest.timeout) + await fulfillment(of: [expectation], timeout: .UnitTest.timeout) } - func testThrowingBlockOperation() { + func testThrowingBlockOperation() async { let expectation = expectation(description: "Should finish") let operation = ResultBlockOperation { @@ -47,10 +47,10 @@ final class AsyncResultBlockOperationTests: XCTestCase { operationQueue.addOperation(operation) - waitForExpectations(timeout: .UnitTest.timeout) + await fulfillment(of: [expectation], timeout: .UnitTest.timeout) } - func testCancellableTaskOperation() { + func testCancellableTaskOperation() async { let expectation = expectation(description: "Should finish") let operation = ResultBlockOperation<Bool> { finish -> Cancellable in @@ -71,6 +71,6 @@ final class AsyncResultBlockOperationTests: XCTestCase { operationQueue.addOperation(operation) - waitForExpectations(timeout: .UnitTest.timeout) + await fulfillment(of: [expectation], timeout: .UnitTest.timeout) } } diff --git a/ios/OperationsTests/OperationConditionTests.swift b/ios/OperationsTests/OperationConditionTests.swift index 26abaca2e9..02be4f3888 100644 --- a/ios/OperationsTests/OperationConditionTests.swift +++ b/ios/OperationsTests/OperationConditionTests.swift @@ -10,6 +10,7 @@ import Operations import XCTest +@MainActor class OperationConditionTests: XCTestCase { func testTrueCondition() { let expectConditionEvaluation = expectation(description: "Expect condition evaluation") |
