MCPcopy
hub / github.com/cli/cli / TestGenManDocExitCodes

Function TestGenManDocExitCodes

internal/docs/man_test.go:132–155  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

130}
131
132func TestGenManDocExitCodes(t *testing.T) {
133 header := &GenManHeader{
134 Title: "Project",
135 Section: "1",
136 }
137 cmd := &cobra.Command{
138 Use: "test-command",
139 Short: "A test command",
140 Long: "A test command for checking exit codes section",
141 }
142 buf := new(bytes.Buffer)
143 if err := renderMan(cmd, header, buf); err != nil {
144 t.Fatal(err)
145 }
146 output := buf.String()
147
148 // Check for the presence of the exit codes section
149 checkStringContains(t, output, ".SH EXIT CODES")
150 checkStringContains(t, output, "0: Successful execution")
151 checkStringContains(t, output, "1: Error")
152 checkStringContains(t, output, "2: Command canceled")
153 checkStringContains(t, output, "4: Authentication required")
154 checkStringContains(t, output, "NOTE: Specific commands may have additional exit codes. Refer to the command's help for more information.")
155}
156
157func TestManPrintFlagsHidesShortDeprecated(t *testing.T) {
158 c := &cobra.Command{}

Callers

nothing calls this directly

Calls 3

renderManFunction · 0.85
checkStringContainsFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected