Skip to content

Commit fd4a97e

Browse files
soranobayounata
andauthored
done compatible with Sendable (#1159)
Co-authored-by: Rachel Brindle <[email protected]>
1 parent 9aaef11 commit fd4a97e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Sources/Nimble/DSL+AsyncAwait.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public func waitUntil(
9393
file: FileString = #filePath,
9494
line: UInt = #line,
9595
column: UInt = #column,
96-
action: @escaping (@escaping () -> Void) async -> Void
96+
action: @escaping (@escaping @Sendable () -> Void) async -> Void
9797
) async {
9898
await throwableUntil(
9999
timeout: timeout,
@@ -116,7 +116,7 @@ public func waitUntil(
116116
file: FileString = #filePath,
117117
line: UInt = #line,
118118
column: UInt = #column,
119-
action: @escaping (@escaping () -> Void) -> Void
119+
action: @escaping (@escaping @Sendable () -> Void) -> Void
120120
) async {
121121
await throwableUntil(
122122
timeout: timeout,
@@ -134,7 +134,7 @@ private enum ErrorResult {
134134
private func throwableUntil(
135135
timeout: NimbleTimeInterval,
136136
sourceLocation: SourceLocation,
137-
action: @escaping (@escaping () -> Void) async throws -> Void) async {
137+
action: @escaping (@escaping @Sendable () -> Void) async throws -> Void) async {
138138
let leeway = timeout.divided
139139
let result = await performBlock(
140140
timeoutInterval: timeout,

Tests/NimbleTests/AsyncAwaitTest.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,15 @@ final class AsyncAwaitTest: XCTestCase { // swiftlint:disable:this type_body_len
189189
}
190190
}
191191

192+
func testWaitUntilUsingSendable() async {
193+
await waitUntil { done in
194+
let queue = OperationQueue()
195+
let op = BlockOperation {}
196+
op.completionBlock = done
197+
queue.addOperation(op)
198+
}
199+
}
200+
192201
func testWaitUntilTimesOutIfNotCalled() async {
193202
await failsWithErrorMessage("Waited more than 1.0 second") {
194203
await waitUntil(timeout: .seconds(1)) { _ in return }

0 commit comments

Comments
 (0)