File tree 1 file changed +8
-3
lines changed
ios/PacketTunnelCoreTests
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -30,9 +30,9 @@ final class TaskSleepTests: XCTestCase {
30
30
/// cancel a `DispatchSourceTimer` in a `Task` trying to call `resume` on its continuation handler more than once
31
31
func testSuccessfulEventHandlerRemovesCancellation( ) async throws {
32
32
for _ in 0 ... 20 {
33
- var task = recoveryTask ( )
33
+ let task = recoveryTask ( )
34
34
try await Task . sleep ( duration: . milliseconds( 10 ) )
35
- task. doAnythingToSilenceAWarning ( )
35
+ task. callDummyFunctionToForceConcurrencyWait ( )
36
36
}
37
37
}
38
38
@@ -46,5 +46,10 @@ final class TaskSleepTests: XCTestCase {
46
46
}
47
47
48
48
private extension AutoCancellingTask {
49
- func doAnythingToSilenceAWarning( ) { }
49
+ /// This function is here to silence a warning about unused variables in `testSuccessfulEventHandlerRemovesCancellation`
50
+ /// The following construct `_ = recoveryTask()` cannot be used as the resulting `AutoCancellingTask`
51
+ /// would immediately get `deinit`ed, changing the test scenario.
52
+ /// A dummy function is needed to make sure the task is not cancelled before concurrency is forced
53
+ /// by having a call to `Task.sleep`
54
+ func callDummyFunctionToForceConcurrencyWait( ) { }
50
55
}
You can’t perform that action at this time.
0 commit comments