MCPcopy Create free account
hub / github.com/cli/cli / TestKramdownCompatibleDocs

Function TestKramdownCompatibleDocs

pkg/cmd/root/help_test.go:66–94  ·  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

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

Callers

nothing calls this directly

Calls 5

TestFunction · 0.92
NewMockConfigFunction · 0.92
NewCmdRootFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected