TestStringArrayFlagSetAccumulates verifies that successive Set calls append. Both forms (repeated flag use and comma-separated values) must accumulate without inserting empty entries.
(t *testing.T)
| 1166 | // Both forms (repeated flag use and comma-separated values) must accumulate |
| 1167 | // without inserting empty entries. |
| 1168 | func TestStringArrayFlagSetAccumulates(t *testing.T) { |
| 1169 | var f StringArrayFlag |
| 1170 | if err := f.Set("a,b"); err != nil { |
| 1171 | t.Fatalf("first Set returned error: %v", err) |
| 1172 | } |
| 1173 | if err := f.Set("c"); err != nil { |
| 1174 | t.Fatalf("second Set returned error: %v", err) |
| 1175 | } |
| 1176 | if err := f.Set(""); err != nil { |
| 1177 | t.Fatalf("third Set returned error: %v", err) |
| 1178 | } |
| 1179 | want := []string{"a", "b", "c"} |
| 1180 | if len(f) != len(want) { |
| 1181 | t.Fatalf("got %v, want %v", []string(f), want) |
| 1182 | } |
| 1183 | for i := range f { |
| 1184 | if f[i] != want[i] { |
| 1185 | t.Errorf("[%d] = %q, want %q", i, f[i], want[i]) |
| 1186 | } |
| 1187 | } |
| 1188 | } |
| 1189 | |
| 1190 | // ─── Layer 13: gcSizes.Alignof additional branches ─────────────────────────── |
| 1191 |
nothing calls this directly
no test coverage detected
searching dependent graphs…