@@ -71,7 +71,7 @@ final class AsyncSemaphoreTests: XCTestCase {
71
71
}
72
72
}
73
73
74
- func test_wait_suspends_on_zero_semaphore_until_signal( ) {
74
+ func test_wait_suspends_on_zero_semaphore_until_signal( ) async {
75
75
// Check DispatchSemaphore behavior
76
76
do {
77
77
// Given a zero semaphore
@@ -88,11 +88,11 @@ final class AsyncSemaphoreTests: XCTestCase {
88
88
} . start ( )
89
89
90
90
// Then the thread is initially blocked.
91
- wait ( for : [ ex1] , timeout: 0.5 )
91
+ await fulfillment ( of : [ ex1] , timeout: 0.5 )
92
92
93
93
// When a signal occurs, then the waiting thread is woken.
94
94
sem. signal ( )
95
- wait ( for : [ ex2] , timeout: 1 )
95
+ await fulfillment ( of : [ ex2] , timeout: 1 )
96
96
}
97
97
98
98
// Test that AsyncSemaphore behaves identically
@@ -111,11 +111,11 @@ final class AsyncSemaphoreTests: XCTestCase {
111
111
}
112
112
113
113
// Then the task is initially suspended.
114
- wait ( for : [ ex1] , timeout: 0.5 )
114
+ await fulfillment ( of : [ ex1] , timeout: 0.5 )
115
115
116
116
// When a signal occurs, then the suspended task is resumed.
117
117
sem. signal ( )
118
- wait ( for : [ ex2] , timeout: 0.5 )
118
+ await fulfillment ( of : [ ex2] , timeout: 0.5 )
119
119
}
120
120
}
121
121
@@ -134,7 +134,7 @@ final class AsyncSemaphoreTests: XCTestCase {
134
134
}
135
135
try await Task . sleep ( nanoseconds: 100_000_000 )
136
136
task. cancel ( )
137
- wait ( for : [ ex] , timeout: 1 )
137
+ await fulfillment ( of : [ ex] , timeout: 1 )
138
138
}
139
139
140
140
func test_cancellation_before_suspension_throws_CancellationError( ) throws {
@@ -180,14 +180,14 @@ final class AsyncSemaphoreTests: XCTestCase {
180
180
}
181
181
182
182
// Then the task is initially suspended.
183
- wait ( for : [ ex1] , timeout: 0.5 )
183
+ await fulfillment ( of : [ ex1] , timeout: 0.5 )
184
184
185
185
// When a signal occurs, then the suspended task is resumed.
186
186
sem. signal ( )
187
- wait ( for : [ ex2] , timeout: 0.5 )
187
+ await fulfillment ( of : [ ex2] , timeout: 0.5 )
188
188
}
189
189
190
- func test_that_cancellation_before_suspension_increments_the_semaphore( ) throws {
190
+ func test_that_cancellation_before_suspension_increments_the_semaphore( ) async throws {
191
191
// Given a task cancelled before it waits on a semaphore,
192
192
let sem = AsyncSemaphore ( value: 0 )
193
193
let task = Task {
@@ -212,11 +212,11 @@ final class AsyncSemaphoreTests: XCTestCase {
212
212
}
213
213
214
214
// Then the task is initially suspended.
215
- wait ( for : [ ex1] , timeout: 0.5 )
215
+ await fulfillment ( of : [ ex1] , timeout: 0.5 )
216
216
217
217
// When a signal occurs, then the suspended task is resumed.
218
218
sem. signal ( )
219
- wait ( for : [ ex2] , timeout: 0.5 )
219
+ await fulfillment ( of : [ ex2] , timeout: 0.5 )
220
220
}
221
221
222
222
// Inspired by <https://github.com/groue/Semaphore/pull/3>
@@ -241,7 +241,7 @@ final class AsyncSemaphoreTests: XCTestCase {
241
241
}
242
242
243
243
// Then the second task is not suspended.
244
- wait ( for : [ ex] , timeout: 0.5 )
244
+ await fulfillment ( of : [ ex] , timeout: 0.5 )
245
245
}
246
246
247
247
// Test that semaphore can limit the number of concurrent executions of
0 commit comments