1
2
3
4
5 package windows_test
6
7 import (
8 "errors"
9 "internal/syscall/windows"
10 "syscall"
11 "testing"
12 )
13
14 func TestSupportUnixSocket(t *testing.T) {
15 var d syscall.WSAData
16 if err := syscall.WSAStartup(uint32(0x202), &d); err != nil {
17 t.Fatal(err)
18 }
19 defer syscall.WSACleanup()
20
21
22 got := windows.SupportUnixSocket()
23 s, err := windows.WSASocket(syscall.AF_UNIX, syscall.SOCK_STREAM, 0, nil, 0, windows.WSA_FLAG_NO_HANDLE_INHERIT)
24 if err == nil {
25 syscall.Closesocket(s)
26 }
27 want := !errors.Is(err, windows.WSAEAFNOSUPPORT) && !errors.Is(err, windows.WSAEINVAL)
28 if want != got {
29 t.Errorf("SupportUnixSocket = %v; want %v", got, want)
30 }
31 }
32
View as plain text