Skip to content

Commit d200f48

Browse files
committed
TestFoundation: replace sleep with Thread.sleep(forTimeInterval:)
Windows does not have a `sleep` function but does have `Sleep`. Rather than conditionalise the path, use `Thread.sleep(forTimeInterval:)` which makes the path uniform for all the targets.
1 parent abe5c1f commit d200f48

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

TestFoundation/TestURLSession.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ class TestURLSession : LoopbackServerTest {
807807
task1.resume()
808808
task2.resume()
809809
session.invalidateAndCancel()
810-
sleep(1)
810+
Thread.sleep(forTimeInterval: 1)
811811

812812
session.getAllTasks { tasksBeforeResume in
813813
XCTAssertEqual(tasksBeforeResume.count, 0)
@@ -828,7 +828,7 @@ class TestURLSession : LoopbackServerTest {
828828
let delegate = SessionDelegate()
829829
let session = URLSession(configuration: .default, delegate: delegate, delegateQueue: nil)
830830
session.invalidateAndCancel()
831-
sleep(2)
831+
Thread.sleep(forTimeInterval: 2)
832832
XCTAssertNil(session.delegate)
833833
}
834834

0 commit comments

Comments
 (0)