(t *testing.T)
| 269 | } |
| 270 | |
| 271 | func Test_helpCommand_Action_ErrorIfNoTopic(t *testing.T) { |
| 272 | cmd := &Command{} |
| 273 | |
| 274 | _ = cmd.Run(context.Background(), []string{"foo", "bar"}) |
| 275 | |
| 276 | err := helpCommandAction(context.Background(), cmd) |
| 277 | require.Error(t, err, "expected error from helpCommandAction()") |
| 278 | |
| 279 | exitErr, ok := err.(*exitError) |
| 280 | require.True(t, ok, "expected *exitError from helpCommandAction()") |
| 281 | |
| 282 | require.Contains(t, exitErr.Error(), "No help topic for", "expected an unknown help topic error") |
| 283 | require.Equal(t, 3, exitErr.exitCode, "expected exit value = 3") |
| 284 | } |
| 285 | |
| 286 | func Test_helpCommand_InHelpOutput(t *testing.T) { |
| 287 | cmd := &Command{} |
nothing calls this directly
no test coverage detected