mirror of
https://github.com/safing/portmaster
synced 2025-04-20 10:59:10 +00:00
29 lines
522 B
Go
29 lines
522 B
Go
package netenv
|
|
|
|
import (
|
|
"flag"
|
|
"testing"
|
|
)
|
|
|
|
var privileged bool
|
|
|
|
func init() {
|
|
flag.BoolVar(&privileged, "privileged", false, "run tests that require root/admin privileges")
|
|
}
|
|
|
|
func TestGetInternetLocation(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
if testing.Short() {
|
|
t.Skip()
|
|
}
|
|
if !privileged {
|
|
t.Skip("skipping privileged test, active with -privileged argument")
|
|
}
|
|
|
|
loc, ok := GetInternetLocation()
|
|
if !ok {
|
|
t.Fatal("GetApproximateInternetLocation failed")
|
|
}
|
|
t.Logf("GetApproximateInternetLocation: %+v", loc)
|
|
}
|