simplify the unit test for windows

This commit is contained in:
Albert Sundjaja 2025-02-08 17:57:32 +11:00
parent 40a763c3d1
commit 3dbcc8bded
1 changed files with 4 additions and 5 deletions

View File

@ -75,13 +75,12 @@ func TestUnixAbstractLongNameNullStart(t *testing.T) {
t.Skip("unix test")
}
addr := "\x00abstract_test"
rsu := syscall.RawSockaddrUnix{}
paddedAddr := make([]byte, len(rsu.Path))
// Create an abstract socket name that starts with a null byte ("\x00")
// whose length is the maximum of RawSockaddrUnix Path len
paddedAddr := make([]byte, len(syscall.RawSockaddrUnix{}.Path))
copy(paddedAddr, "\x00abstract_test")
addr = string(paddedAddr)
la, err := ResolveUnixAddr("unix", addr)
la, err := ResolveUnixAddr("unix", string(paddedAddr))
if err != nil {
t.Fatal(err)
}