MCPcopy
hub / github.com/cli/cli / TestGenMdDoc

Function TestGenMdDoc

internal/docs/markdown_test.go:12–30  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestGenMdDoc(t *testing.T) {
13 linkHandler := func(s string) string { return s }
14
15 // We generate on subcommand so we have both subcommands and parents.
16 buf := new(bytes.Buffer)
17 if err := genMarkdownCustom(echoCmd, buf, linkHandler); err != nil {
18 t.Fatal(err)
19 }
20 output := buf.String()
21
22 checkStringContains(t, output, echoCmd.Long)
23 checkStringContains(t, output, echoCmd.Example)
24 checkStringContains(t, output, "boolone")
25 checkStringContains(t, output, "rootflag")
26 checkStringOmits(t, output, rootCmd.Short)
27 checkStringOmits(t, output, echoSubCmd.Short)
28 checkStringOmits(t, output, deprecatedCmd.Short)
29 checkStringContains(t, output, "Options inherited from parent commands")
30}
31
32func TestGenMdDocWithNoLongOrSynopsis(t *testing.T) {
33 linkHandler := func(s string) string { return s }

Callers

nothing calls this directly

Calls 4

genMarkdownCustomFunction · 0.85
checkStringContainsFunction · 0.85
checkStringOmitsFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected