Skip to content

Commit 3a1355e

Browse files
authored
Merge pull request swiftlang#347 from compnerd/usleep
LanguageServerProtocolJSONRPCTests: add Windows stubs
2 parents cd588d3 + cc702e2 commit 3a1355e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Tests/LanguageServerProtocolJSONRPCTests/ConnectionTests.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ import LanguageServerProtocolJSONRPC
1515
import LSPTestSupport
1616
import XCTest
1717

18+
#if os(Windows)
19+
import WinSDK
20+
#endif
21+
1822
// Workaround ambiguity with Foundation.
1923
typealias Notification = LanguageServerProtocol.Notification
2024

@@ -258,8 +262,13 @@ class ConnectionTests: XCTestCase {
258262
})
259263

260264
to.fileHandleForWriting.closeFile()
265+
#if os(Windows)
266+
// 1 ms was chosen for simplicity.
267+
_ = Sleep(1)
268+
#else
261269
// 100 us was chosen empirically to encourage races.
262270
usleep(100)
271+
#endif
263272
conn.close()
264273

265274
waitForExpectations(timeout: 10)

0 commit comments

Comments
 (0)