summaryrefslogtreecommitdiffhomepage
path: root/tun/wintun/setupapi/zsetupapi_windows_test.go
blob: 09b9195955aa4faa30c0d8b1f5d2f5beab0f0304 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* SPDX-License-Identifier: MIT
 *
 * Copyright (C) 2019 WireGuard LLC. All Rights Reserved.
 */

package setupapi

import (
	"syscall"
	"testing"

	"golang.org/x/sys/windows"
)

func TestSetupDiDestroyDeviceInfoList(t *testing.T) {
	err := SetupDiDestroyDeviceInfoList(DevInfo(windows.InvalidHandle))
	if errWin, ok := err.(syscall.Errno); !ok || errWin != 6 /*ERROR_INVALID_HANDLE*/ {
		t.Errorf("SetupDiDestroyDeviceInfoList(nil, ...) should fail with ERROR_INVALID_HANDLE")
	}
}