fix abs path with symlinks

Signed-off-by: Nestor <nesterran@gmail.com>
This commit is contained in:
Nestor
2019-02-22 15:08:26 +01:00
parent 70719a8f65
commit 1eab47b63f
3 changed files with 31 additions and 3 deletions

View File

@@ -17,6 +17,7 @@ limitations under the License.
package fs
import (
"path/filepath"
"testing"
)
@@ -101,3 +102,18 @@ func TestHasPrefix_SlashFooBar(t *testing.T) {
t.Fatalf("/foo/bar should have prefix /")
}
}
func TestNewTempConfirmDir(t *testing.T) {
tmp, err := NewTmpConfirmedDir()
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
delinked, err := filepath.EvalSymlinks(string(tmp))
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if string(tmp) != delinked {
t.Fatalf("unexpected path containing symlinks")
}
}