github.com/alecthomas/kong@v0.9.1-0.20240410131203-2ab5733f1179/mapper_linux_test.go (about)

     1  //go:build !windows
     2  // +build !windows
     3  
     4  package kong_test
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/alecthomas/assert/v2"
    10  )
    11  
    12  func 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  }