diff options
Diffstat (limited to 'libgo/go/path/filepath/path_test.go')
-rw-r--r-- | libgo/go/path/filepath/path_test.go | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/libgo/go/path/filepath/path_test.go b/libgo/go/path/filepath/path_test.go index c81cbf0ddc7..2bd62d34aeb 100644 --- a/libgo/go/path/filepath/path_test.go +++ b/libgo/go/path/filepath/path_test.go @@ -317,7 +317,7 @@ func checkMarks(t *testing.T, report bool) { // Assumes that each node name is unique. Good enough for a test. // If clear is true, any incoming error is cleared before return. The errors // are always accumulated, though. -func mark(path string, info *os.FileInfo, err error, errors *[]error, clear bool) error { +func mark(path string, info os.FileInfo, err error, errors *[]error, clear bool) error { if err != nil { *errors = append(*errors, err) if clear { @@ -325,8 +325,9 @@ func mark(path string, info *os.FileInfo, err error, errors *[]error, clear bool } return err } + name := info.Name() walkTree(tree, tree.name, func(path string, n *Node) { - if n.name == info.Name { + if n.name == name { n.mark++ } }) @@ -337,7 +338,7 @@ func TestWalk(t *testing.T) { makeTree(t) errors := make([]error, 0, 10) clear := true - markFn := func(path string, info *os.FileInfo, err error) error { + markFn := func(path string, info os.FileInfo, err error) error { return mark(path, info, err, &errors, clear) } // Expect no errors. @@ -548,7 +549,7 @@ func TestEvalSymlinks(t *testing.T) { // relative testEvalSymlinks(t, tests) // absolute -/* These tests do not work in the gccgo test environment. + /* These tests do not work in the gccgo test environment. goroot, err := filepath.EvalSymlinks(os.Getenv("GOROOT")) if err != nil { t.Fatalf("EvalSymlinks(%q) error: %v", os.Getenv("GOROOT"), err) @@ -564,7 +565,7 @@ func TestEvalSymlinks(t *testing.T) { } } testEvalSymlinks(t, tests) -*/ + */ } /* These tests do not work in the gccgo test environment. @@ -603,7 +604,7 @@ func TestAbs(t *testing.T) { t.Errorf("Abs(%q) error: %v", path, err) } absinfo, err := os.Stat(abspath) - if err != nil || absinfo.Ino != info.Ino { + if err != nil || !absinfo.(*os.FileStat).SameFile(info.(*os.FileStat)) { t.Errorf("Abs(%q)=%q, not the same file", path, abspath) } if !filepath.IsAbs(abspath) { @@ -634,6 +635,10 @@ var reltests = []RelTests{ {"a/b/../c", "a/b", "../b"}, {"a/b/c", "a/c/d", "../../c/d"}, {"a/b", "c/d", "../../c/d"}, + {"a/b/c/d", "a/b", "../.."}, + {"a/b/c/d", "a/b/", "../.."}, + {"a/b/c/d/", "a/b", "../.."}, + {"a/b/c/d/", "a/b/", "../.."}, {"../../a/b", "../../a/b/c/d", "c/d"}, {"/a/b", "/a/b", "."}, {"/a/b/.", "/a/b", "."}, @@ -645,6 +650,10 @@ var reltests = []RelTests{ {"/a/b/../c", "/a/b", "../b"}, {"/a/b/c", "/a/c/d", "../../c/d"}, {"/a/b", "/c/d", "../../c/d"}, + {"/a/b/c/d", "/a/b", "../.."}, + {"/a/b/c/d", "/a/b/", "../.."}, + {"/a/b/c/d/", "/a/b", "../.."}, + {"/a/b/c/d/", "/a/b/", "../.."}, {"/../../a/b", "/../../a/b/c/d", "c/d"}, {".", "a/b", "a/b"}, {".", "..", ".."}, |