Skip to content

Commit db3ccb1

Browse files
committed
TestFoundation: use Thread.sleep(forTimeInterval:) rather than sleep
`sleep` is not portable; use `Thread.sleep(forTimeInterval:)`.
1 parent 7c273e1 commit db3ccb1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

TestFoundation/TestOperationQueue.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class TestOperationQueue : XCTestCase {
120120
for i in 0..<5 {
121121
let operation = BlockOperation {
122122
valueOperations.append(i)
123-
sleep(2)
123+
Thread.sleep(forTimeInterval: 2)
124124
}
125125
operations.append(operation)
126126
}
@@ -139,14 +139,14 @@ class TestOperationQueue : XCTestCase {
139139

140140
let operation1 = BlockOperation {
141141
valueOperations.append(0)
142-
sleep(2)
142+
Thread.sleep(forTimeInterval: 2)
143143
}
144144
operation1.queuePriority = .high
145145
operations.append(operation1)
146146

147147
let operation2 = BlockOperation {
148148
valueOperations.append(1)
149-
sleep(2)
149+
Thread.sleep(forTimeInterval: 2)
150150
}
151151
operation2.queuePriority = .high
152152
operations.append(operation2)

0 commit comments

Comments
 (0)