(t *testing.T)
| 145 | } |
| 146 | |
| 147 | func TestF64SAsSliceValue(t *testing.T) { |
| 148 | var f64s []float64 |
| 149 | f := setUpF64SFlagSet(&f64s) |
| 150 | |
| 151 | in := []string{"1.0", "2.0"} |
| 152 | argfmt := "--f64s=%s" |
| 153 | arg1 := fmt.Sprintf(argfmt, in[0]) |
| 154 | arg2 := fmt.Sprintf(argfmt, in[1]) |
| 155 | err := f.Parse([]string{arg1, arg2}) |
| 156 | if err != nil { |
| 157 | t.Fatal("expected no error; got", err) |
| 158 | } |
| 159 | |
| 160 | f.VisitAll(func(f *Flag) { |
| 161 | if val, ok := f.Value.(SliceValue); ok { |
| 162 | _ = val.Replace([]string{"3.1"}) |
| 163 | } |
| 164 | }) |
| 165 | if len(f64s) != 1 || f64s[0] != 3.1 { |
| 166 | t.Fatalf("Expected ss to be overwritten with '3.1', but got: %v", f64s) |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | func TestF64SCalledTwice(t *testing.T) { |
| 171 | var f64s []float64 |
nothing calls this directly
no test coverage detected