(t *testing.T)
| 1157 | } |
| 1158 | |
| 1159 | func TestCommand_CommandWithNoFlagBeforeTerminator(t *testing.T) { |
| 1160 | var args Args |
| 1161 | |
| 1162 | cmd := &Command{ |
| 1163 | Commands: []*Command{ |
| 1164 | { |
| 1165 | Name: "cmd", |
| 1166 | Action: func(_ context.Context, cmd *Command) error { |
| 1167 | args = cmd.Args() |
| 1168 | return nil |
| 1169 | }, |
| 1170 | }, |
| 1171 | }, |
| 1172 | } |
| 1173 | |
| 1174 | require.NoError(t, cmd.Run(buildTestContext(t), []string{"", "cmd", "my-arg", "--", "notAFlagAtAll"})) |
| 1175 | |
| 1176 | require.NotNil(t, args) |
| 1177 | require.Equal(t, "my-arg", args.Get(0)) |
| 1178 | require.Equal(t, "notAFlagAtAll", args.Get(1)) |
| 1179 | } |
| 1180 | |
| 1181 | func TestCommand_SkipFlagParsing(t *testing.T) { |
| 1182 | var args Args |
nothing calls this directly
no test coverage detected