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

Function TestCompleteCmdInZshScript

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

Source from the content-addressed store, hash-verified

1605}
1606
1607func TestCompleteCmdInZshScript(t *testing.T) {
1608 rootCmd := &Command{Use: "root", Args: NoArgs, Run: emptyRun}
1609 child := &Command{
1610 Use: "child",
1611 ValidArgsFunction: validArgsFunc,
1612 Run: emptyRun,
1613 }
1614 rootCmd.AddCommand(child)
1615
1616 buf := new(bytes.Buffer)
1617 assertNoErr(t, rootCmd.GenZshCompletion(buf))
1618 output := buf.String()
1619
1620 check(t, output, ShellCompRequestCmd)
1621 checkOmit(t, output, ShellCompNoDescRequestCmd)
1622}
1623
1624func TestFlagCompletionInGo(t *testing.T) {
1625 rootCmd := &Command{

Callers

nothing calls this directly

Calls 6

AddCommandMethod · 0.95
GenZshCompletionMethod · 0.95
checkFunction · 0.85
checkOmitFunction · 0.85
StringMethod · 0.80
assertNoErrFunction · 0.70

Tested by

no test coverage detected