mirror of
https://git.zx2c4.com/wireguard-go
synced 2024-11-15 01:05:15 +01:00
Stop accessing SetupDiGetDeviceInfoListDetail() output on error
The data returned by SetupDiGetDeviceInfoListDetail() is nil on error which will cause the test to crash should the function fail. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
e821cdabd2
commit
963be8e993
@ -99,8 +99,7 @@ func TestSetupDiGetDeviceInfoListDetailLocal(t *testing.T) {
|
||||
data, err := SetupDiGetDeviceInfoListDetail(devInfoList)
|
||||
if err != nil {
|
||||
t.Errorf("Error calling SetupDiGetDeviceInfoListDetail: %s", err.Error())
|
||||
}
|
||||
|
||||
} else {
|
||||
if data.ClassGUID != deviceClassNetGUID {
|
||||
t.Error("SetupDiGetDeviceInfoListDetail returned different class GUID")
|
||||
}
|
||||
@ -113,6 +112,7 @@ func TestSetupDiGetDeviceInfoListDetailLocal(t *testing.T) {
|
||||
t.Error("SetupDiGetDeviceInfoListDetail returned non-NULL remote machine name")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetupDiGetDeviceInfoListDetailRemote(t *testing.T) {
|
||||
devInfoList, err := SetupDiGetClassDevsEx(&deviceClassNetGUID, "", 0, DIGCF_PRESENT, DevInfo(0), computerName)
|
||||
@ -124,8 +124,7 @@ func TestSetupDiGetDeviceInfoListDetailRemote(t *testing.T) {
|
||||
data, err := SetupDiGetDeviceInfoListDetail(devInfoList)
|
||||
if err != nil {
|
||||
t.Errorf("Error calling SetupDiGetDeviceInfoListDetail: %s", err.Error())
|
||||
}
|
||||
|
||||
} else {
|
||||
if data.ClassGUID != deviceClassNetGUID {
|
||||
t.Error("SetupDiGetDeviceInfoListDetail returned different class GUID")
|
||||
}
|
||||
@ -138,6 +137,7 @@ func TestSetupDiGetDeviceInfoListDetailRemote(t *testing.T) {
|
||||
t.Error("SetupDiGetDeviceInfoListDetail returned different remote machine name")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetupDiEnumDeviceInfo(t *testing.T) {
|
||||
devInfoList, err := SetupDiGetClassDevsEx(&deviceClassNetGUID, "", 0, DIGCF_PRESENT, DevInfo(0), "")
|
||||
|
Loading…
Reference in New Issue
Block a user