treat \ as escape only before a separator
This commit is contained in:
committed by
Alec Thomas
parent
5538b7f045
commit
29685e7da6
@@ -0,0 +1,26 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package kong_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestPathMapper(t *testing.T) {
|
||||
var cli struct {
|
||||
Path string `arg:"" type:"path"`
|
||||
}
|
||||
p := mustNew(t, &cli)
|
||||
|
||||
_, err := p.Parse([]string{"/an/absolute/path"})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "/an/absolute/path", cli.Path)
|
||||
|
||||
_, err = p.Parse([]string{"-"})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "-", cli.Path)
|
||||
}
|
||||
Reference in New Issue
Block a user