(t *testing.T)
| 2713 | } |
| 2714 | |
| 2715 | func TestCommand_Run_CustomFlagCanUseVersionAlias(t *testing.T) { |
| 2716 | buf := new(bytes.Buffer) |
| 2717 | called := false |
| 2718 | |
| 2719 | cmd := &Command{ |
| 2720 | Name: "boom", |
| 2721 | Version: "0.1.0", |
| 2722 | Writer: buf, |
| 2723 | Flags: []Flag{ |
| 2724 | &BoolFlag{Name: "verbose", Aliases: []string{"v"}}, |
| 2725 | }, |
| 2726 | Action: func(_ context.Context, cmd *Command) error { |
| 2727 | called = true |
| 2728 | assert.True(t, cmd.Bool("verbose")) |
| 2729 | return nil |
| 2730 | }, |
| 2731 | } |
| 2732 | |
| 2733 | err := cmd.Run(buildTestContext(t), []string{"boom", "-v"}) |
| 2734 | |
| 2735 | assert.NoError(t, err) |
| 2736 | assert.True(t, called) |
| 2737 | assert.Empty(t, buf.String()) |
| 2738 | } |
| 2739 | |
| 2740 | func TestCommand_Run_Categories(t *testing.T) { |
| 2741 | buf := new(bytes.Buffer) |
nothing calls this directly
no test coverage detected