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

Function TestPathMapper

mapper_linux_test.go:12–25  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestPathMapper(t *testing.T) {
13 var cli struct {
14 Path string `arg:"" type:"path"`
15 }
16 p := mustNew(t, &cli)
17
18 _, err := p.Parse([]string{"/an/absolute/path"})
19 assert.NoError(t, err)
20 assert.Equal(t, "/an/absolute/path", cli.Path)
21
22 _, err = p.Parse([]string{"-"})
23 assert.NoError(t, err)
24 assert.Equal(t, "-", cli.Path)
25}

Callers

nothing calls this directly

Calls 2

mustNewFunction · 0.85
ParseMethod · 0.45

Tested by

no test coverage detected