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

Function TestCompleteCmdInBashScript

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

Source from the content-addressed store, hash-verified

1573}
1574
1575func TestCompleteCmdInBashScript(t *testing.T) {
1576 rootCmd := &Command{Use: "root", Args: NoArgs, Run: emptyRun}
1577 child := &Command{
1578 Use: "child",
1579 ValidArgsFunction: validArgsFunc,
1580 Run: emptyRun,
1581 }
1582 rootCmd.AddCommand(child)
1583
1584 buf := new(bytes.Buffer)
1585 assertNoErr(t, rootCmd.GenBashCompletion(buf))
1586 output := buf.String()
1587
1588 check(t, output, ShellCompNoDescRequestCmd)
1589}
1590
1591func TestCompleteNoDesCmdInZshScript(t *testing.T) {
1592 rootCmd := &Command{Use: "root", Args: NoArgs, Run: emptyRun}

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected