MCPcopy
hub / github.com/cli/cli / TestKramdownCompatibleDocs

Function TestKramdownCompatibleDocs

pkg/cmd/root/help_test.go:65–93  ·  view source on GitHub ↗

Since our online docs website renders pages by using the kramdown (a superset of Markdown) engine, we have to check against some known quirks of the syntax.

(t *testing.T)

Source from the content-addressed store, hash-verified

63// of Markdown) engine, we have to check against some known quirks of the
64// syntax.
65func TestKramdownCompatibleDocs(t *testing.T) {
66 ios, _, _, _ := iostreams.Test()
67 f := &cmdutil.Factory{
68 IOStreams: ios,
69 Config: func() (gh.Config, error) { return config.NewBlankConfig(), nil },
70 Browser: &browser.Stub{},
71 ExtensionManager: &extensions.ExtensionManagerMock{
72 ListFunc: func() []extensions.Extension {
73 return nil
74 },
75 },
76 }
77
78 cmd, err := NewCmdRoot(f, &telemetry.NoOpService{}, "N/A", "")
79 require.NoError(t, err)
80
81 var walk func(*cobra.Command)
82 walk = func(cmd *cobra.Command) {
83 name := fmt.Sprintf("%q: test pipes are in code blocks", cmd.UseLine())
84 t.Run(name, func(t *testing.T) {
85 assertPipesAreInCodeBlocks(t, cmd)
86 })
87 for _, child := range cmd.Commands() {
88 walk(child)
89 }
90 }
91
92 walk(cmd)
93}
94
95// If not in a code block or a code span, kramdown treats pipes ("|") as table
96// column separators, even if there's no table header, or left/right table row

Callers

nothing calls this directly

Calls 5

TestFunction · 0.92
NewBlankConfigFunction · 0.92
NewCmdRootFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected