Skip to content

Commit b12e9c2

Browse files
committed
Fix compiler warnings
1 parent 8f3204a commit b12e9c2

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Tests/SemaphoreTests/AsyncSemaphoreTests.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ final class AsyncSemaphoreTests: XCTestCase {
7171
}
7272
}
7373

74-
func test_wait_suspends_on_zero_semaphore_until_signal() {
74+
func test_wait_suspends_on_zero_semaphore_until_signal() async {
7575
// Check DispatchSemaphore behavior
7676
do {
7777
// Given a zero semaphore
@@ -88,11 +88,11 @@ final class AsyncSemaphoreTests: XCTestCase {
8888
}.start()
8989

9090
// Then the thread is initially blocked.
91-
wait(for: [ex1], timeout: 0.5)
91+
await fulfillment(of: [ex1], timeout: 0.5)
9292

9393
// When a signal occurs, then the waiting thread is woken.
9494
sem.signal()
95-
wait(for: [ex2], timeout: 1)
95+
await fulfillment(of: [ex2], timeout: 1)
9696
}
9797

9898
// Test that AsyncSemaphore behaves identically
@@ -111,11 +111,11 @@ final class AsyncSemaphoreTests: XCTestCase {
111111
}
112112

113113
// Then the task is initially suspended.
114-
wait(for: [ex1], timeout: 0.5)
114+
await fulfillment(of: [ex1], timeout: 0.5)
115115

116116
// When a signal occurs, then the suspended task is resumed.
117117
sem.signal()
118-
wait(for: [ex2], timeout: 0.5)
118+
await fulfillment(of: [ex2], timeout: 0.5)
119119
}
120120
}
121121

@@ -134,7 +134,7 @@ final class AsyncSemaphoreTests: XCTestCase {
134134
}
135135
try await Task.sleep(nanoseconds: 100_000_000)
136136
task.cancel()
137-
wait(for: [ex], timeout: 1)
137+
await fulfillment(of: [ex], timeout: 1)
138138
}
139139

140140
func test_cancellation_before_suspension_throws_CancellationError() throws {
@@ -180,14 +180,14 @@ final class AsyncSemaphoreTests: XCTestCase {
180180
}
181181

182182
// Then the task is initially suspended.
183-
wait(for: [ex1], timeout: 0.5)
183+
await fulfillment(of: [ex1], timeout: 0.5)
184184

185185
// When a signal occurs, then the suspended task is resumed.
186186
sem.signal()
187-
wait(for: [ex2], timeout: 0.5)
187+
await fulfillment(of: [ex2], timeout: 0.5)
188188
}
189189

190-
func test_that_cancellation_before_suspension_increments_the_semaphore() throws {
190+
func test_that_cancellation_before_suspension_increments_the_semaphore() async throws {
191191
// Given a task cancelled before it waits on a semaphore,
192192
let sem = AsyncSemaphore(value: 0)
193193
let task = Task {
@@ -212,11 +212,11 @@ final class AsyncSemaphoreTests: XCTestCase {
212212
}
213213

214214
// Then the task is initially suspended.
215-
wait(for: [ex1], timeout: 0.5)
215+
await fulfillment(of: [ex1], timeout: 0.5)
216216

217217
// When a signal occurs, then the suspended task is resumed.
218218
sem.signal()
219-
wait(for: [ex2], timeout: 0.5)
219+
await fulfillment(of: [ex2], timeout: 0.5)
220220
}
221221

222222
// Inspired by <https://github.com/groue/Semaphore/pull/3>
@@ -241,7 +241,7 @@ final class AsyncSemaphoreTests: XCTestCase {
241241
}
242242

243243
// Then the second task is not suspended.
244-
wait(for: [ex], timeout: 0.5)
244+
await fulfillment(of: [ex], timeout: 0.5)
245245
}
246246

247247
// Test that semaphore can limit the number of concurrent executions of

0 commit comments

Comments
 (0)