MCPcopy Create free account
hub / github.com/conforma/cli / TestPreRunE

Function TestPreRunE

cmd/track/track_bundle_test.go:300–340  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

298}
299
300func 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}

Callers

nothing calls this directly

Calls 3

trackBundleCmdFunction · 0.85
RunMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected