|
|
@ -23,18 +23,15 @@ import ( |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
func TestPathExpansion(t *testing.T) { |
|
|
|
func TestPathExpansion(t *testing.T) { |
|
|
|
|
|
|
|
|
|
|
|
user, _ := user.Current() |
|
|
|
user, _ := user.Current() |
|
|
|
|
|
|
|
|
|
|
|
tests := map[string]string{ |
|
|
|
tests := map[string]string{ |
|
|
|
"/home/someuser/tmp": "/home/someuser/tmp", |
|
|
|
"/home/someuser/tmp": "/home/someuser/tmp", |
|
|
|
"~/tmp": user.HomeDir + "/tmp", |
|
|
|
"~/tmp": user.HomeDir + "/tmp", |
|
|
|
|
|
|
|
"~thisOtherUser/b/": "~thisOtherUser/b", |
|
|
|
"$DDDXXX/a/b": "/tmp/a/b", |
|
|
|
"$DDDXXX/a/b": "/tmp/a/b", |
|
|
|
"/a/b/": "/a/b", |
|
|
|
"/a/b/": "/a/b", |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
os.Setenv("DDDXXX", "/tmp") |
|
|
|
os.Setenv("DDDXXX", "/tmp") |
|
|
|
|
|
|
|
|
|
|
|
for test, expected := range tests { |
|
|
|
for test, expected := range tests { |
|
|
|
got := expandPath(test) |
|
|
|
got := expandPath(test) |
|
|
|
if got != expected { |
|
|
|
if got != expected { |
|
|
|