(t *testing.T)
| 298 | } |
| 299 | |
| 300 | func TestPreRunE(t *testing.T) { |
| 301 | cases := []struct { |
| 302 | name string |
| 303 | args []string |
| 304 | err string |
| 305 | }{ |
| 306 | { |
| 307 | name: "bundles", |
| 308 | args: []string{"-b", "b1", "--bundle", "b2"}, |
| 309 | }, |
| 310 | { |
| 311 | name: "input", |
| 312 | args: []string{"--input", "some-file"}, |
| 313 | }, |
| 314 | { |
| 315 | name: "git", |
| 316 | args: []string{"--git", "git-ref"}, |
| 317 | }, |
| 318 | { |
| 319 | name: "no bundle, input nor git", |
| 320 | err: "at least one of the flags in the group [bundle git input] is required", |
| 321 | }, |
| 322 | } |
| 323 | |
| 324 | for _, c := range cases { |
| 325 | t.Run(c.name, func(t *testing.T) { |
| 326 | tbc := trackBundleCmd(nil, nil, nil) |
| 327 | if err := tbc.ParseFlags(c.args); err != nil { |
| 328 | t.Error(err) |
| 329 | } |
| 330 | |
| 331 | err := tbc.ValidateFlagGroups() |
| 332 | |
| 333 | if c.err != "" { |
| 334 | assert.EqualError(t, err, c.err) |
| 335 | } else { |
| 336 | assert.NoError(t, err) |
| 337 | } |
| 338 | }) |
| 339 | } |
| 340 | } |
nothing calls this directly
no test coverage detected