(t *testing.T)
| 157 | } |
| 158 | |
| 159 | func TestF32SAsSliceValue(t *testing.T) { |
| 160 | var f32s []float32 |
| 161 | f := setUpF32SFlagSet(&f32s) |
| 162 | |
| 163 | in := []string{"1.0", "2.0"} |
| 164 | argfmt := "--f32s=%s" |
| 165 | arg1 := fmt.Sprintf(argfmt, in[0]) |
| 166 | arg2 := fmt.Sprintf(argfmt, in[1]) |
| 167 | err := f.Parse([]string{arg1, arg2}) |
| 168 | if err != nil { |
| 169 | t.Fatal("expected no error; got", err) |
| 170 | } |
| 171 | |
| 172 | f.VisitAll(func(f *Flag) { |
| 173 | if val, ok := f.Value.(SliceValue); ok { |
| 174 | _ = val.Replace([]string{"3.1"}) |
| 175 | } |
| 176 | }) |
| 177 | if len(f32s) != 1 || f32s[0] != 3.1 { |
| 178 | t.Fatalf("Expected ss to be overwritten with '3.1', but got: %v", f32s) |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | func TestF32SCalledTwice(t *testing.T) { |
| 183 | var f32s []float32 |
nothing calls this directly
no test coverage detected