(t *testing.T)
| 1486 | } |
| 1487 | |
| 1488 | func TestCommand_ParseSliceFlagsWithMissingValue(t *testing.T) { |
| 1489 | var parsedIntSlice []int64 |
| 1490 | var parsedStringSlice []string |
| 1491 | |
| 1492 | cmd := &Command{ |
| 1493 | Commands: []*Command{ |
| 1494 | { |
| 1495 | Name: "cmd", |
| 1496 | Flags: []Flag{ |
| 1497 | &Int64SliceFlag{Name: "a", Usage: "set numbers"}, |
| 1498 | &StringSliceFlag{Name: "str", Usage: "set strings"}, |
| 1499 | }, |
| 1500 | Action: func(_ context.Context, cmd *Command) error { |
| 1501 | parsedIntSlice = cmd.Int64Slice("a") |
| 1502 | parsedStringSlice = cmd.StringSlice("str") |
| 1503 | return nil |
| 1504 | }, |
| 1505 | }, |
| 1506 | }, |
| 1507 | } |
| 1508 | |
| 1509 | r := require.New(t) |
| 1510 | |
| 1511 | r.NoError(cmd.Run(buildTestContext(t), []string{"", "cmd", "-a", "2", "-str", "A"})) |
| 1512 | r.Equal([]int64{2}, parsedIntSlice) |
| 1513 | r.Equal([]string{"A"}, parsedStringSlice) |
| 1514 | } |
| 1515 | |
| 1516 | func TestCommand_DefaultStdin(t *testing.T) { |
| 1517 | cmd := &Command{} |
nothing calls this directly
no test coverage detected
searching dependent graphs…