(t *testing.T)
| 541 | } |
| 542 | |
| 543 | func TestCommand_Run_SubcommandsCanUseErrWriter(t *testing.T) { |
| 544 | cmd := &Command{ |
| 545 | ErrWriter: io.Discard, |
| 546 | Name: "bar", |
| 547 | Usage: "this is for testing", |
| 548 | Commands: []*Command{ |
| 549 | { |
| 550 | Name: "baz", |
| 551 | Usage: "this is for testing", |
| 552 | Action: func(_ context.Context, cmd *Command) error { |
| 553 | require.Equal(t, io.Discard, cmd.Root().ErrWriter) |
| 554 | |
| 555 | return nil |
| 556 | }, |
| 557 | }, |
| 558 | }, |
| 559 | } |
| 560 | |
| 561 | require.NoError(t, cmd.Run(buildTestContext(t), []string{"bar", "baz"})) |
| 562 | } |
| 563 | |
| 564 | func TestCommandSkipFlagParsing(t *testing.T) { |
| 565 | cases := []struct { |
nothing calls this directly
no test coverage detected