diff options
Diffstat (limited to 'src/pkg/path/filepath')
| -rw-r--r-- | src/pkg/path/filepath/path.go | 2 | ||||
| -rw-r--r-- | src/pkg/path/filepath/path_test.go | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/pkg/path/filepath/path.go b/src/pkg/path/filepath/path.go index 147256a1d3..124de989a7 100644 --- a/src/pkg/path/filepath/path.go +++ b/src/pkg/path/filepath/path.go @@ -247,7 +247,7 @@ func EvalSymlinks(path string) (string, os.Error) { // path name for a given file is not guaranteed to be unique. func Abs(path string) (string, os.Error) { if IsAbs(path) { - return path, nil + return Clean(path), nil } wd, err := os.Getwd() if err != nil { diff --git a/src/pkg/path/filepath/path_test.go b/src/pkg/path/filepath/path_test.go index b147349836..624c9d8ffd 100644 --- a/src/pkg/path/filepath/path_test.go +++ b/src/pkg/path/filepath/path_test.go @@ -509,6 +509,7 @@ var abstests = []string{ // Already absolute "$GOROOT/src/Make.pkg", + "$GOROOT/src/../src/Make.pkg", } func TestAbs(t *testing.T) { @@ -537,5 +538,8 @@ func TestAbs(t *testing.T) { if !filepath.IsAbs(abspath) { t.Errorf("Abs(%q)=%q, not an absolute path", path, abspath) } + if filepath.IsAbs(path) && abspath != filepath.Clean(path) { + t.Errorf("Abs(%q)=%q, isn't clean", path, abspath) + } } } |
