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

Function TestGenRSTDoc

doc/rest_docs_test.go:26–41  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func TestGenRSTDoc(t *testing.T) {
27 // We generate on a subcommand so we have both subcommands and parents
28 buf := new(bytes.Buffer)
29 if err := GenReST(echoCmd, buf); err != nil {
30 t.Fatal(err)
31 }
32 output := buf.String()
33
34 checkStringContains(t, output, echoCmd.Long)
35 checkStringContains(t, output, echoCmd.Example)
36 checkStringContains(t, output, "boolone")
37 checkStringContains(t, output, "rootflag")
38 checkStringContains(t, output, rootCmd.Short)
39 checkStringContains(t, output, echoSubCmd.Short)
40 checkStringOmits(t, output, deprecatedCmd.Short)
41}
42
43func TestGenRSTNoHiddenParents(t *testing.T) {
44 // We generate on a subcommand so we have both subcommands and parents

Callers

nothing calls this directly

Calls 4

GenReSTFunction · 0.85
StringMethod · 0.80
checkStringContainsFunction · 0.70
checkStringOmitsFunction · 0.70

Tested by

no test coverage detected