treat \ as escape only before a separator

This commit is contained in:
David Shiflet
2022-05-03 21:19:51 -04:00
committed by Alec Thomas
parent 5538b7f045
commit 29685e7da6
5 changed files with 86 additions and 20 deletions
+5 -2
View File
@@ -4,6 +4,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
@@ -62,7 +63,9 @@ func TestChangeDirFlag(t *testing.T) {
p := Must(&cli)
_, err = p.Parse([]string{"-C", dir, "out.txt"})
require.NoError(t, err)
file, err = filepath.EvalSymlinks(file) // Needed because OSX uses a symlinked tmp dir.
require.NoError(t, err)
if runtime.GOOS != "windows" {
file, err = filepath.EvalSymlinks(file) // Needed because OSX uses a symlinked tmp dir.
require.NoError(t, err)
}
require.Equal(t, file, cli.Path)
}