(t *testing.T)
| 122 | } |
| 123 | |
| 124 | func TestIPSCalledTwice(t *testing.T) { |
| 125 | var ips []net.IP |
| 126 | f := setUpIPSFlagSet(&ips) |
| 127 | |
| 128 | in := []string{"192.168.1.2,0:0:0:0:0:0:0:1", "10.0.0.1"} |
| 129 | expected := []net.IP{net.ParseIP("192.168.1.2"), net.ParseIP("0:0:0:0:0:0:0:1"), net.ParseIP("10.0.0.1")} |
| 130 | argfmt := "ips=%s" |
| 131 | arg1 := fmt.Sprintf(argfmt, in[0]) |
| 132 | arg2 := fmt.Sprintf(argfmt, in[1]) |
| 133 | err := f.Parse([]string{arg1, arg2}) |
| 134 | if err != nil { |
| 135 | t.Fatal("expected no error; got", err) |
| 136 | } |
| 137 | for i, v := range ips { |
| 138 | if !expected[i].Equal(v) { |
| 139 | t.Fatalf("expected ips[%d] to be %s but got: %s", i, expected[i], v) |
| 140 | } |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | func TestIPSAsSliceValue(t *testing.T) { |
| 145 | var ips []net.IP |
nothing calls this directly
no test coverage detected