@@ -31,15 +31,15 @@ struct CancellableQueueTests {
3131 func cancelTasks_fifoQueue_doesNotCancelCompletedTask( ) async {
3232 let systemUnderTest = CancellableQueue ( underlyingQueue: FIFOQueue ( ) )
3333
34- // Create a task that completes immediately
34+ // Create a task that completes immediately.
3535 let task = Task ( on: systemUnderTest) {
3636 try doWork ( )
3737 }
3838
39- // Wait for the task to complete
39+ // Wait for the task to complete.
4040 _ = await task. result
4141
42- // Now cancel tasks - should have no effect since task already completed
42+ // Now cancel tasks - should have no effect since task already completed.
4343 systemUnderTest. cancelTasks ( )
4444
4545 #expect( !task. isCancelled)
@@ -51,16 +51,16 @@ struct CancellableQueueTests {
5151 let taskStarted = Semaphore ( )
5252 let taskAllowedToEnd = Semaphore ( )
5353
54- // Create a task that signals when it starts, then waits
54+ // Create a task that signals when it starts, then waits.
5555 let task = Task ( on: systemUnderTest) {
5656 await taskStarted. signal ( )
5757 await taskAllowedToEnd. wait ( )
5858 }
5959
60- // Wait for the task to start executing
60+ // Wait for the task to start executing.
6161 await taskStarted. wait ( )
6262
63- // Cancel all tasks
63+ // Cancel all tasks.
6464 systemUnderTest. cancelTasks ( )
6565
6666 // Allow the task to end now that we've cancelled it.
@@ -76,21 +76,21 @@ struct CancellableQueueTests {
7676 let taskAllowedToEnd = Semaphore ( )
7777 let counter = Counter ( )
7878
79- // Create a task that signals when it starts
79+ // Create a task that signals when it starts.
8080 let task1 = Task ( on: systemUnderTest, isolatedTo: counter) { _ in
8181 await taskStarted. signal ( )
8282 await taskAllowedToEnd. wait ( )
8383 }
8484
85- // Create pending tasks that won't start until the first task completes
85+ // Create pending tasks that won't start until the first task completes.
8686 let task2 = Task ( on: systemUnderTest, isolatedTo: counter) { _ in }
8787
8888 let task3 = Task ( on: systemUnderTest, isolatedTo: counter) { _ in }
8989
90- // Wait for the first task to start executing
90+ // Wait for the first task to start executing.
9191 await taskStarted. wait ( )
9292
93- // Cancel all tasks
93+ // Cancel all tasks.
9494 systemUnderTest. cancelTasks ( )
9595
9696 // Allow the task to end now that we've cancelled it.
@@ -106,10 +106,10 @@ struct CancellableQueueTests {
106106 let systemUnderTest = CancellableQueue ( underlyingQueue: FIFOQueue ( ) )
107107 let counter = Counter ( )
108108
109- // Cancel tasks before creating any
109+ // Cancel tasks before creating any.
110110 systemUnderTest. cancelTasks ( )
111111
112- // Create a task after cancellation - it should NOT be cancelled
112+ // Create a task after cancellation - it should NOT be cancelled.
113113 let task = Task ( on: systemUnderTest, isolatedTo: counter) { _ in
114114 try doWork ( )
115115 }
@@ -124,15 +124,15 @@ struct CancellableQueueTests {
124124 actorQueue. adoptExecutionContext ( of: counter)
125125 let systemUnderTest = CancellableQueue ( underlyingQueue: actorQueue)
126126
127- // Create a task that completes immediately
127+ // Create a task that completes immediately.
128128 let task = Task ( on: systemUnderTest) { _ in
129129 try doWork ( )
130130 }
131131
132- // Wait for the task to complete
132+ // Wait for the task to complete.
133133 _ = await task. result
134134
135- // Now cancel tasks - should have no effect since task already completed
135+ // Now cancel tasks - should have no effect since task already completed.
136136 systemUnderTest. cancelTasks ( )
137137
138138 #expect( !task. isCancelled)
@@ -147,16 +147,16 @@ struct CancellableQueueTests {
147147 let taskStarted = Semaphore ( )
148148 let taskAllowedToEnd = Semaphore ( )
149149
150- // Create a task that signals when it starts, then waits
150+ // Create a task that signals when it starts, then waits.
151151 let task = Task ( on: systemUnderTest) { _ in
152152 await taskStarted. signal ( )
153153 await taskAllowedToEnd. wait ( )
154154 }
155155
156- // Wait for the task to start executing
156+ // Wait for the task to start executing.
157157 await taskStarted. wait ( )
158158
159- // Cancel all tasks
159+ // Cancel all tasks.
160160 systemUnderTest. cancelTasks ( )
161161
162162 // Allow the task to end now that we've cancelled it.
@@ -176,7 +176,7 @@ struct CancellableQueueTests {
176176 let task3Started = Semaphore ( )
177177 let tasksAllowedToEnd = Semaphore ( )
178178
179- // Create tasks that signal when they start, then wait
179+ // Create tasks that signal when they start, then wait.
180180 let task1 = Task ( on: systemUnderTest) { _ in
181181 await task1Started. signal ( )
182182 await tasksAllowedToEnd. wait ( )
@@ -192,12 +192,12 @@ struct CancellableQueueTests {
192192 await tasksAllowedToEnd. wait ( )
193193 }
194194
195- // Wait for all tasks to start executing
195+ // Wait for all tasks to start executing.
196196 await task1Started. wait ( )
197197 await task2Started. wait ( )
198198 await task3Started. wait ( )
199199
200- // Cancel all tasks
200+ // Cancel all tasks.
201201 systemUnderTest. cancelTasks ( )
202202
203203 // Allow tasks to end now that we've cancelled them.
@@ -217,10 +217,10 @@ struct CancellableQueueTests {
217217 actorQueue. adoptExecutionContext ( of: counter)
218218 let systemUnderTest = CancellableQueue ( underlyingQueue: actorQueue)
219219
220- // Cancel tasks before creating any
220+ // Cancel tasks before creating any.
221221 systemUnderTest. cancelTasks ( )
222222
223- // Create a task after cancellation - it should NOT be cancelled
223+ // Create a task after cancellation - it should NOT be cancelled.
224224 let task = Task ( on: systemUnderTest) { _ in
225225 try doWork ( )
226226 }
@@ -232,15 +232,15 @@ struct CancellableQueueTests {
232232 func cancelTasks_mainActorQueue_doesNotCancelCompletedTask( ) async {
233233 let systemUnderTest = CancellableQueue ( underlyingQueue: MainActor . queue)
234234
235- // Create a task that completes immediately
235+ // Create a task that completes immediately.
236236 let task = Task ( on: systemUnderTest) {
237237 try doWork ( )
238238 }
239239
240- // Wait for the task to complete
240+ // Wait for the task to complete.
241241 _ = await task. result
242242
243- // Now cancel tasks - should have no effect since task already completed
243+ // Now cancel tasks - should have no effect since task already completed.
244244 systemUnderTest. cancelTasks ( )
245245
246246 #expect( !task. isCancelled)
@@ -252,13 +252,13 @@ struct CancellableQueueTests {
252252 let taskStarted = Semaphore ( )
253253 let taskAllowedToEnd = Semaphore ( )
254254
255- // Create a task that signals when it starts, then waits
255+ // Create a task that signals when it starts, then waits.
256256 let task = Task ( on: systemUnderTest) {
257257 await taskStarted. signal ( )
258258 await taskAllowedToEnd. wait ( )
259259 }
260260
261- // Wait for the task to start executing
261+ // Wait for the task to start executing.
262262 await taskStarted. wait ( )
263263
264264 // Cancel all tasks
@@ -278,7 +278,7 @@ struct CancellableQueueTests {
278278 let task3Started = Semaphore ( )
279279 let tasksAllowedToEnd = Semaphore ( )
280280
281- // Create tasks that signal when they start, then wait
281+ // Create tasks that signal when they start, then wait.
282282 let task1 = Task ( on: systemUnderTest) {
283283 await task1Started. signal ( )
284284 await tasksAllowedToEnd. wait ( )
@@ -294,12 +294,12 @@ struct CancellableQueueTests {
294294 await tasksAllowedToEnd. wait ( )
295295 }
296296
297- // Wait for all tasks to start executing
297+ // Wait for all tasks to start executing.
298298 await task1Started. wait ( )
299299 await task2Started. wait ( )
300300 await task3Started. wait ( )
301301
302- // Cancel all tasks
302+ // Cancel all tasks.
303303 systemUnderTest. cancelTasks ( )
304304
305305 // Allow tasks to end now that we've cancelled them.
@@ -316,10 +316,10 @@ struct CancellableQueueTests {
316316 func cancelTasks_mainActorQueue_doesNotCancelFutureTasks( ) {
317317 let systemUnderTest = CancellableQueue ( underlyingQueue: MainActor . queue)
318318
319- // Cancel tasks before creating any
319+ // Cancel tasks before creating any.
320320 systemUnderTest. cancelTasks ( )
321321
322- // Create a task after cancellation - it should NOT be cancelled
322+ // Create a task after cancellation - it should NOT be cancelled.
323323 let task = Task ( on: systemUnderTest) {
324324 try doWork ( )
325325 }
0 commit comments