MCPcopy Create free account
hub / github.com/alecthomas/kong / TestExistingFileMapperSlice

Function TestExistingFileMapperSlice

mapper_test.go:615–627  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

613}
614
615func 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
629func TestExistingFileMapperDefaultMissing(t *testing.T) {
630 type CLI struct {

Callers

nothing calls this directly

Calls 2

mustNewFunction · 0.85
ParseMethod · 0.45

Tested by

no test coverage detected