mirror of
https://github.com/nxtrace/NTrace-core.git
synced 2026-12-01 17:02:33 +00:00
23 lines
738 B
Go
23 lines
738 B
Go
//go:build windows || (!darwin && !linux)
|
|
|
|
package internal
|
|
|
|
import "testing"
|
|
|
|
func TestBindPacketConnToSourceDeviceStubAllowsEmptyDevice(t *testing.T) {
|
|
if err := bindPacketConnToSourceDevice(nil, 4, ""); err != nil {
|
|
t.Fatalf("bindPacketConnToSourceDevice() error = %v, want nil when device is empty", err)
|
|
}
|
|
}
|
|
|
|
func TestBindPacketConnToSourceDeviceStubRejectsExplicitDevice(t *testing.T) {
|
|
err := bindPacketConnToSourceDevice(nil, 4, "Ethernet0")
|
|
if err == nil {
|
|
t.Fatal("bindPacketConnToSourceDevice() error = nil, want non-nil")
|
|
}
|
|
want := "binding to source device not supported on this platform: Ethernet0"
|
|
if err.Error() != want {
|
|
t.Fatalf("bindPacketConnToSourceDevice() error = %q, want %q", err.Error(), want)
|
|
}
|
|
}
|