diff --git a/Tests/IdentifiableContinuationTests.swift b/Tests/IdentifiableContinuationTests.swift index 2219fe7..40a2643 100644 --- a/Tests/IdentifiableContinuationTests.swift +++ b/Tests/IdentifiableContinuationTests.swift @@ -266,7 +266,7 @@ private extension Actor { func identifiableContinuation( body: @Sendable (IdentifiableContinuation) -> Void, - onCancel handler: @Sendable (IdentifiableContinuation.ID) -> Void = { _ in } + onCancel handler: @Sendable (IdentifiableContinuation.ID) -> Void = { _ in } ) async -> T { #if compiler(>=6.0) await withIdentifiableContinuation(body: body, onCancel: handler) @@ -277,7 +277,7 @@ private extension Actor { func throwingIdentifiableContinuation( body: @Sendable (IdentifiableContinuation) -> Void, - onCancel handler: @Sendable (IdentifiableContinuation.ID) -> Void = { _ in } + onCancel handler: @Sendable (IdentifiableContinuation.ID) -> Void = { _ in } ) async throws -> T { #if compiler(>=6.0) try await withIdentifiableThrowingContinuation(body: body, onCancel: handler) diff --git a/Tests/IdentifiableContinuationXCTests.swift b/Tests/IdentifiableContinuationXCTests.swift index 54ff968..668cffe 100644 --- a/Tests/IdentifiableContinuationXCTests.swift +++ b/Tests/IdentifiableContinuationXCTests.swift @@ -64,7 +64,7 @@ final class IdentifiableContinuationAsyncXCTests: XCTestCase { let waiter = Waiter() let task = await waiter.makeTask(onCancel: nil) - await Task.sleep(seconds: 0.1) + try? await Task.sleep(seconds: 0.1) var isEmpty = await waiter.isEmpty XCTAssertFalse(isEmpty) task.cancel() @@ -80,7 +80,7 @@ final class IdentifiableContinuationAsyncXCTests: XCTestCase { let waiter = Waiter() let task = await waiter.makeTask(delay: 1.0, onCancel: nil) - await Task.sleep(seconds: 0.1) + try? await Task.sleep(seconds: 0.1) let isEmpty = await waiter.isEmpty XCTAssertTrue(isEmpty) task.cancel() @@ -129,7 +129,7 @@ final class IdentifiableContinuationAsyncXCTests: XCTestCase { let waiter = Waiter() let task = await waiter.makeTask(onCancel: .failure(CancellationError())) - await Task.sleep(seconds: 0.1) + try? await Task.sleep(seconds: 0.1) var isEmpty = await waiter.isEmpty XCTAssertFalse(isEmpty) task.cancel() @@ -145,7 +145,7 @@ final class IdentifiableContinuationAsyncXCTests: XCTestCase { let waiter = Waiter() let task = await waiter.makeTask(delay: 1.0, onCancel: .failure(CancellationError())) - await Task.sleep(seconds: 0.1) + try? await Task.sleep(seconds: 0.1) let isEmpty = await waiter.isEmpty XCTAssertTrue(isEmpty) task.cancel() @@ -166,7 +166,7 @@ private actor Waiter { func makeTask(delay: TimeInterval = 0, onCancel: T) -> Task where E == Never { Task { - await Task.sleep(seconds: delay) + try? await Task.sleep(seconds: delay) #if compiler(>=6.0) return await withIdentifiableContinuation { addContinuation($0) @@ -185,7 +185,7 @@ private actor Waiter { func makeTask(delay: TimeInterval = 0, onCancel: Result) -> Task where E == any Error { Task { - await Task.sleep(seconds: delay) + try? await Task.sleep(seconds: delay) #if compiler(>=6.0) return try await withIdentifiableThrowingContinuation { addContinuation($0) @@ -240,8 +240,8 @@ private actor Waiter { } private extension Task where Success == Never, Failure == Never { - static func sleep(seconds: TimeInterval) async { - try? await sleep(nanoseconds: UInt64(1_000_000_000 * seconds)) + static func sleep(seconds: TimeInterval) async throws { + try await sleep(nanoseconds: UInt64(1_000_000_000 * seconds)) } }