mirror of
https://github.com/safing/portmaster
synced 2025-09-01 10:09:11 +00:00
29 lines
558 B
Go
29 lines
558 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 TestGetApproximateInternetLocation(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip()
|
|
}
|
|
if !privileged {
|
|
t.Skip("skipping privileged test, active with -privileged argument")
|
|
}
|
|
|
|
ip, err := GetApproximateInternetLocation()
|
|
if err != nil {
|
|
t.Fatalf("GetApproximateInternetLocation failed: %s", err)
|
|
}
|
|
t.Logf("GetApproximateInternetLocation: %s", ip.String())
|
|
}
|