diff options
| author | Gustavo Niemeyer <gustavo@niemeyer.net> | 2011-05-30 22:28:59 -0300 |
|---|---|---|
| committer | Gustavo Niemeyer <gustavo@niemeyer.net> | 2011-05-30 22:28:59 -0300 |
| commit | 463f478dbb2a502b265c08e0eff1b3334a1bfcf9 (patch) | |
| tree | 284eae54eeb8f9c7c0f21edea81651554b0048f4 /src/pkg/path/filepath/path_test.go | |
| parent | 0de328edd63d8e85588309982ce86948548db96b (diff) | |
| download | go-463f478dbb2a502b265c08e0eff1b3334a1bfcf9.tar.xz | |
filepath: Abs must always return a clean path
When I was first coding Abs, I wondered if people wouldn't
expect the path to be consistently clean, even if the path
passed in was already absolute.
CL 4524078 has a potential problem based on exactly that
assumption, so it feels like this behavior is indeed the
most useful and least surprising.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4548074
Diffstat (limited to 'src/pkg/path/filepath/path_test.go')
| -rw-r--r-- | src/pkg/path/filepath/path_test.go | 4 |
1 files changed, 4 insertions, 0 deletions
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) + } } } |
