File: mapper_linux_test.go

package info (click to toggle)
golang-github-alecthomas-kong 0.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 832 kB
  • sloc: sh: 32; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 448 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//go:build !windows
// +build !windows

package kong_test

import (
	"testing"

	"github.com/alecthomas/assert/v2"
)

func TestPathMapper(t *testing.T) {
	var cli struct {
		Path string `arg:"" type:"path"`
	}
	p := mustNew(t, &cli)

	_, err := p.Parse([]string{"/an/absolute/path"})
	assert.NoError(t, err)
	assert.Equal(t, "/an/absolute/path", cli.Path)

	_, err = p.Parse([]string{"-"})
	assert.NoError(t, err)
	assert.Equal(t, "-", cli.Path)
}