diff options
Diffstat (limited to 'tun/wintun/setupapi/setupapi_windows_test.go')
-rw-r--r-- | tun/wintun/setupapi/setupapi_windows_test.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tun/wintun/setupapi/setupapi_windows_test.go b/tun/wintun/setupapi/setupapi_windows_test.go index 73cad7c..d5443ff 100644 --- a/tun/wintun/setupapi/setupapi_windows_test.go +++ b/tun/wintun/setupapi/setupapi_windows_test.go @@ -6,6 +6,7 @@ package setupapi import ( + "runtime" "strings" "syscall" "testing" @@ -471,7 +472,7 @@ func TestSetupDiGetSelectedDevice(t *testing.T) { func TestUTF16ToBuf(t *testing.T) { buf := []uint16{0x0123, 0x4567, 0x89ab, 0xcdef} - buf2 := UTF16ToBuf(buf) + buf2 := utf16ToBuf(buf) if len(buf)*2 != len(buf2) || cap(buf)*2 != cap(buf2) || buf2[0] != 0x23 || buf2[1] != 0x01 || @@ -480,4 +481,5 @@ func TestUTF16ToBuf(t *testing.T) { buf2[6] != 0xef || buf2[7] != 0xcd { t.Errorf("SetupDiSetSelectedDevice(nil) should fail with ERROR_INVALID_USER_BUFFER") } + runtime.KeepAlive(buf) } |