(t *testing.T)
| 142 | } |
| 143 | |
| 144 | func TestIPSAsSliceValue(t *testing.T) { |
| 145 | var ips []net.IP |
| 146 | f := setUpIPSFlagSet(&ips) |
| 147 | |
| 148 | in := []string{"192.168.1.1", "0:0:0:0:0:0:0:1"} |
| 149 | argfmt := "--ips=%s" |
| 150 | arg1 := fmt.Sprintf(argfmt, in[0]) |
| 151 | arg2 := fmt.Sprintf(argfmt, in[1]) |
| 152 | err := f.Parse([]string{arg1, arg2}) |
| 153 | if err != nil { |
| 154 | t.Fatal("expected no error; got", err) |
| 155 | } |
| 156 | |
| 157 | f.VisitAll(func(f *Flag) { |
| 158 | if val, ok := f.Value.(SliceValue); ok { |
| 159 | _ = val.Replace([]string{"192.168.1.2"}) |
| 160 | } |
| 161 | }) |
| 162 | if len(ips) != 1 || !ips[0].Equal(net.ParseIP("192.168.1.2")) { |
| 163 | t.Fatalf("Expected ss to be overwritten with '192.168.1.2', but got: %v", ips) |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | func TestIPSBadQuoting(t *testing.T) { |
| 168 |
nothing calls this directly
no test coverage detected