eval symlink of ioutil.TempDir

This commit is contained in:
Guangyu Zhang 2014-09-28 11:08:45 +08:00
parent e0212a7353
commit 154517ceb0

View File

@ -3,6 +3,7 @@ package util
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
)
@ -12,7 +13,8 @@ func TestGetwd(t *testing.T) {
t.Errorf("Got error when creating temp dir: %v", error)
} else {
os.Chdir(dir)
if gotwd := Getwd(); gotwd != dir {
dir, error = filepath.EvalSymlinks(dir)
if gotwd := Getwd(); gotwd != dir || error != nil {
t.Errorf("Getwd() -> %v, want %v", gotwd, dir)
}
os.Remove(dir)