(t *testing.T)
| 151 | } |
| 152 | |
| 153 | func TestI32SAsSliceValue(t *testing.T) { |
| 154 | var i32s []int32 |
| 155 | f := setUpI32SFlagSet(&i32s) |
| 156 | |
| 157 | in := []string{"1", "2"} |
| 158 | argfmt := "--is=%s" |
| 159 | arg1 := fmt.Sprintf(argfmt, in[0]) |
| 160 | arg2 := fmt.Sprintf(argfmt, in[1]) |
| 161 | err := f.Parse([]string{arg1, arg2}) |
| 162 | if err != nil { |
| 163 | t.Fatal("expected no error; got", err) |
| 164 | } |
| 165 | |
| 166 | f.VisitAll(func(f *Flag) { |
| 167 | if val, ok := f.Value.(SliceValue); ok { |
| 168 | _ = val.Replace([]string{"3"}) |
| 169 | } |
| 170 | }) |
| 171 | if len(i32s) != 1 || i32s[0] != 3 { |
| 172 | t.Fatalf("Expected ss to be overwritten with '3.1', but got: %v", i32s) |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | func TestI32SCalledTwice(t *testing.T) { |
| 177 | var is []int32 |
nothing calls this directly
no test coverage detected