Skip to content

Commit 0cf60ac

Browse files
committed
update tests
1 parent bcfe31d commit 0cf60ac

File tree

2 files changed

+8
-26
lines changed

2 files changed

+8
-26
lines changed

Tests/IdentifiableContinuationTests.swift

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import Foundation
3535
import Testing
3636

37-
struct IdentifiableContinuationAsyncTests {
37+
struct IdentifiableContinuationTests {
3838

3939
@Test
4040
func resumesWithValue() async {
@@ -220,40 +220,30 @@ private actor Waiter<T: Sendable, E: Error> {
220220
}
221221

222222
private func addContinuation(_ continuation: Continuation) {
223-
safeAssertIsolated()
223+
assertIsolated()
224224
waiting[continuation.id] = continuation
225225
}
226226

227227
private func resumeID(_ id: Continuation.ID, returning value: T) {
228-
safeAssertIsolated()
228+
assertIsolated()
229229
if let continuation = waiting.removeValue(forKey: id) {
230230
continuation.resume(returning: value)
231231
}
232232
}
233233

234234
private func resumeID(_ id: Continuation.ID, throwing error: E) {
235-
safeAssertIsolated()
235+
assertIsolated()
236236
if let continuation = waiting.removeValue(forKey: id) {
237237
continuation.resume(throwing: error)
238238
}
239239
}
240240

241241
private func resumeID(_ id: Continuation.ID, with result: Result<T, E>) {
242-
safeAssertIsolated()
242+
assertIsolated()
243243
if let continuation = waiting.removeValue(forKey: id) {
244244
continuation.resume(with: result)
245245
}
246246
}
247-
248-
private func safeAssertIsolated() {
249-
#if compiler(>=5.10)
250-
assertIsolated()
251-
#elseif compiler(>=5.9)
252-
if #available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *) {
253-
assertIsolated()
254-
}
255-
#endif
256-
}
257247
}
258248

259249
private extension Task where Success == Never, Failure == Never {
@@ -265,25 +255,17 @@ private extension Task where Success == Never, Failure == Never {
265255
private extension Actor {
266256

267257
func identifiableContinuation<T: Sendable>(
268-
body: @Sendable (IdentifiableContinuation<T, Never>) -> Void,
258+
body: @Sendable (IdentifiableContinuation<T, Never>) -> Void,
269259
onCancel handler: @Sendable (IdentifiableContinuation<T, Never>.ID) -> Void = { _ in }
270260
) async -> T {
271-
#if compiler(>=6.0)
272261
await withIdentifiableContinuation(body: body, onCancel: handler)
273-
#else
274-
await withIdentifiableContinuation(isolation: self, body: body, onCancel: handler)
275-
#endif
276262
}
277263

278264
func throwingIdentifiableContinuation<T: Sendable>(
279-
body: @Sendable (IdentifiableContinuation<T, any Error>) -> Void,
265+
body: @Sendable (IdentifiableContinuation<T, any Error>) -> Void,
280266
onCancel handler: @Sendable (IdentifiableContinuation<T, any Error>.ID) -> Void = { _ in }
281267
) async throws -> T {
282-
#if compiler(>=6.0)
283268
try await withIdentifiableThrowingContinuation(body: body, onCancel: handler)
284-
#else
285-
try await withIdentifiableThrowingContinuation(isolation: self, body: body, onCancel: handler)
286-
#endif
287269

288270
}
289271
}

Tests/IdentifiableContinuationXCTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import IdentifiableContinuation
3434
import XCTest
3535

36-
final class IdentifiableContinuationAsyncXCTests: XCTestCase {
36+
final class IdentifiableContinuationXCTests: XCTestCase {
3737

3838
func testResumesWithValue() async {
3939
let waiter = Waiter<String?, Never>()

0 commit comments

Comments
 (0)