This commit is contained in:
Matthew Fisher 2018-05-16 10:43:43 -07:00
Родитель 8ecec2b49f
Коммит 4e3b6da92e
1 изменённых файлов: 0 добавлений и 18 удалений

Просмотреть файл

@ -4,7 +4,6 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"testing" "testing"
) )
@ -54,21 +53,4 @@ func TestSymlinkWithFallback(t *testing.T) {
if err := SymlinkWithFallback(oldFileNamePath, newFileNamePath); err != nil { if err := SymlinkWithFallback(oldFileNamePath, newFileNamePath); err != nil {
t.Errorf("expected no error when calling SymlinkWithFallback() on a file that exists, got %v", err) t.Errorf("expected no error when calling SymlinkWithFallback() on a file that exists, got %v", err)
} }
if runtime.GOOS == "windows" {
exists, err := Exists(oldFileNamePath)
if err != nil {
t.Errorf("expected no error when calling Exists() on a file that does not exist, got %v", err)
}
if exists {
// check that newFileName is a symlink. If this succeeds, then we are running this test as a
// user that has permission to create symbolic links, so the old file should still exist.
newFile, err := os.Lstat(newFileNamePath)
if err != nil {
t.Error(err)
}
if newFile.Mode() != os.ModeSymlink {
t.Errorf("expected %s to be removed when %s is not a symbolic link", oldFileNamePath, newFileNamePath)
}
}
}
} }