| 613 | } |
| 614 | |
| 615 | func TestExistingFileMapperSlice(t *testing.T) { |
| 616 | type CLI struct { |
| 617 | Files []string `type:"existingfile"` |
| 618 | } |
| 619 | var cli CLI |
| 620 | p := mustNew(t, &cli) |
| 621 | _, err := p.Parse([]string{"--files", "testdata/file.txt", "--files", "testdata/file.txt"}) |
| 622 | assert.NoError(t, err) |
| 623 | assert.NotZero(t, cli.Files) |
| 624 | pwd, err := os.Getwd() |
| 625 | assert.NoError(t, err) |
| 626 | assert.Equal(t, []string{filepath.Join(pwd, "testdata", "file.txt"), filepath.Join(pwd, "testdata", "file.txt")}, cli.Files) |
| 627 | } |
| 628 | |
| 629 | func TestExistingFileMapperDefaultMissing(t *testing.T) { |
| 630 | type CLI struct { |