(t *testing.T)
| 42 | } |
| 43 | |
| 44 | func TestIPS(t *testing.T) { |
| 45 | var ips []net.IP |
| 46 | f := setUpIPSFlagSet(&ips) |
| 47 | |
| 48 | vals := []string{"192.168.1.1", "10.0.0.1", "0:0:0:0:0:0:0:2"} |
| 49 | arg := fmt.Sprintf("--ips=%s", strings.Join(vals, ",")) |
| 50 | err := f.Parse([]string{arg}) |
| 51 | if err != nil { |
| 52 | t.Fatal("expected no error; got", err) |
| 53 | } |
| 54 | for i, v := range ips { |
| 55 | if ip := net.ParseIP(vals[i]); ip == nil { |
| 56 | t.Fatalf("invalid string being converted to IP address: %s", vals[i]) |
| 57 | } else if !ip.Equal(v) { |
| 58 | t.Fatalf("expected ips[%d] to be %s but got: %s from GetIPSlice", i, vals[i], v) |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | func TestIPSDefault(t *testing.T) { |
| 64 | var ips []net.IP |
nothing calls this directly
no test coverage detected