@@ -15,6 +15,10 @@ import SystemPackage
1515import System
1616#endif
1717
18+ #if os(Windows)
19+ import WinSDK
20+ #endif
21+
1822/*System 0.0.1, @available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)*/
1923final class ErrnoTest : XCTestCase {
2024 func testConstants( ) {
@@ -61,9 +65,15 @@ final class ErrnoTest: XCTestCase {
6165 XCTAssert ( EPROTOTYPE == Errno . protocolWrongTypeForSocket. rawValue)
6266 XCTAssert ( ENOPROTOOPT == Errno . protocolNotAvailable. rawValue)
6367 XCTAssert ( EPROTONOSUPPORT == Errno . protocolNotSupported. rawValue)
68+ #if os(Windows)
69+ XCTAssert ( WSAESOCKTNOSUPPORT == Errno . socketTypeNotSupported. rawValue)
70+ XCTAssert ( WSAEOPNOTSUPP == Errno . notSupported. rawValue)
71+ XCTAssert ( WSAEPFNOSUPPORT == Errno . protocolFamilyNotSupported. rawValue)
72+ #else
6473 XCTAssert ( ESOCKTNOSUPPORT == Errno . socketTypeNotSupported. rawValue)
6574 XCTAssert ( ENOTSUP == Errno . notSupported. rawValue)
6675 XCTAssert ( EPFNOSUPPORT == Errno . protocolFamilyNotSupported. rawValue)
76+ #endif
6777 XCTAssert ( EAFNOSUPPORT == Errno . addressFamilyNotSupported. rawValue)
6878 XCTAssert ( EADDRINUSE == Errno . addressInUse. rawValue)
6979 XCTAssert ( EADDRNOTAVAIL == Errno . addressNotAvailable. rawValue)
@@ -75,22 +85,36 @@ final class ErrnoTest: XCTestCase {
7585 XCTAssert ( ENOBUFS == Errno . noBufferSpace. rawValue)
7686 XCTAssert ( EISCONN == Errno . socketIsConnected. rawValue)
7787 XCTAssert ( ENOTCONN == Errno . socketNotConnected. rawValue)
88+ #if os(Windows)
89+ XCTAssert ( WSAESHUTDOWN == Errno . socketShutdown. rawValue)
90+ #else
7891 XCTAssert ( ESHUTDOWN == Errno . socketShutdown. rawValue)
92+ #endif
7993 XCTAssert ( ETIMEDOUT == Errno . timedOut. rawValue)
8094 XCTAssert ( ECONNREFUSED == Errno . connectionRefused. rawValue)
8195 XCTAssert ( ELOOP == Errno . tooManySymbolicLinkLevels. rawValue)
8296 XCTAssert ( ENAMETOOLONG == Errno . fileNameTooLong. rawValue)
97+ #if os(Windows)
98+ XCTAssert ( WSAEHOSTDOWN == Errno . hostIsDown. rawValue)
99+ #else
83100 XCTAssert ( EHOSTDOWN == Errno . hostIsDown. rawValue)
101+ #endif
84102 XCTAssert ( EHOSTUNREACH == Errno . noRouteToHost. rawValue)
85103 XCTAssert ( ENOTEMPTY == Errno . directoryNotEmpty. rawValue)
86104
87105#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
88106 XCTAssert ( EPROCLIM == Errno . tooManyProcesses. rawValue)
89107#endif
90108
109+ #if os(Windows)
110+ XCTAssert ( WSAEUSERS == Errno . tooManyUsers. rawValue)
111+ XCTAssert ( WSAEDQUOT == Errno . diskQuotaExceeded. rawValue)
112+ XCTAssert ( WSAESTALE == Errno . staleNFSFileHandle. rawValue)
113+ #else
91114 XCTAssert ( EUSERS == Errno . tooManyUsers. rawValue)
92115 XCTAssert ( EDQUOT == Errno . diskQuotaExceeded. rawValue)
93116 XCTAssert ( ESTALE == Errno . staleNFSFileHandle. rawValue)
117+ #endif
94118
95119#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
96120 XCTAssert ( EBADRPC == Errno . rpcUnsuccessful. rawValue)
@@ -141,8 +165,13 @@ final class ErrnoTest: XCTestCase {
141165
142166 // From headers but not man page
143167 XCTAssert ( EWOULDBLOCK == Errno . wouldBlock. rawValue)
168+ #if os(Windows)
169+ XCTAssert ( WSAETOOMANYREFS == Errno . tooManyReferences. rawValue)
170+ XCTAssert ( WSAEREMOTE == Errno . tooManyRemoteLevels. rawValue)
171+ #else
144172 XCTAssert ( ETOOMANYREFS == Errno . tooManyReferences. rawValue)
145173 XCTAssert ( EREMOTE == Errno . tooManyRemoteLevels. rawValue)
174+ #endif
146175
147176#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
148177 XCTAssert ( ENOPOLICY == Errno . noSuchPolicy. rawValue)
0 commit comments