MCPcopy
hub / github.com/spf13/cobra / TestChildTakesArgs

Function TestChildTakesArgs

args_test.go:429–438  ·  args_test.go::TestChildTakesArgs
(t *testing.T)

Source from the content-addressed store, hash-verified

427}
428
429func TestChildTakesArgs(t *testing.T) {
430 rootCmd := &Command{Use: "root", Run: emptyRun}
431 childCmd := &Command{Use: "child", Args: ArbitraryArgs, Run: emptyRun}
432 rootCmd.AddCommand(childCmd)
433
434 _, err := executeCommand(rootCmd, "child", "legal", "args")
435 if err != nil {
436 t.Fatalf("Unexpected error: %v", err)
437 }
438}
439
440func TestMatchAll(t *testing.T) {
441 // Somewhat contrived example check that ensures there are exactly 3

Callers

nothing calls this directly

Calls 2

AddCommandMethod · 0.95
executeCommandFunction · 0.85

Tested by

no test coverage detected