(t *testing.T)
| 130 | } |
| 131 | |
| 132 | func 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 | |
| 157 | func TestManPrintFlagsHidesShortDeprecated(t *testing.T) { |
| 158 | c := &cobra.Command{} |
nothing calls this directly
no test coverage detected