lib/env: Make env_test.go support Windows

s3-about
id01 2019-05-13 20:05:11 -07:00 committed by Nick Craig-Wood
parent 9c6f3ae82c
commit abeb12c6df
1 changed files with 5 additions and 4 deletions

9
lib/env/env_test.go vendored
View File

@ -2,6 +2,7 @@ package env
import (
"os"
"path/filepath"
"testing"
homedir "github.com/mitchellh/go-homedir"
@ -20,10 +21,10 @@ func TestShellExpand(t *testing.T) {
in, want string
}{
{"", ""},
{"~", home},
{"~/dir/file.txt", home + "/dir/file.txt"},
{"/dir/~/file.txt", "/dir/~/file.txt"},
{"~/${EXPAND_TEST}", home + "/potato"},
{"~", filepath.FromSlash(home)},
{filepath.FromSlash("~/dir/file.txt"), filepath.FromSlash(home + "/dir/file.txt")},
{filepath.FromSlash("/dir/~/file.txt"), filepath.FromSlash("/dir/~/file.txt")},
{filepath.FromSlash("~/${EXPAND_TEST}"), filepath.FromSlash(home + "/potato")},
} {
got := ShellExpand(test.in)
assert.Equal(t, test.want, got, test.in)