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

Function TestNoValidArgsFuncInBashScript

completions_test.go:1560–1573  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1558}
1559
1560func TestNoValidArgsFuncInBashScript(t *testing.T) {
1561 rootCmd := &Command{Use: "root", Args: NoArgs, Run: emptyRun}
1562 child := &Command{
1563 Use: "child",
1564 Run: emptyRun,
1565 }
1566 rootCmd.AddCommand(child)
1567
1568 buf := new(bytes.Buffer)
1569 assertNoErr(t, rootCmd.GenBashCompletion(buf))
1570 output := buf.String()
1571
1572 checkOmit(t, output, "has_completion_function=1")
1573}
1574
1575func TestCompleteCmdInBashScript(t *testing.T) {
1576 rootCmd := &Command{Use: "root", Args: NoArgs, Run: emptyRun}

Callers

nothing calls this directly

Calls 5

AddCommandMethod · 0.95
GenBashCompletionMethod · 0.95
checkOmitFunction · 0.85
StringMethod · 0.80
assertNoErrFunction · 0.70

Tested by

no test coverage detected