aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/path/filepath/path_test.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-11-30 12:04:16 -0500
committerRuss Cox <rsc@golang.org>2011-11-30 12:04:16 -0500
commit8dce57e169255608b46bb563bb7de1581908aea6 (patch)
tree5085e50b9543c434ec73df356b7661fdaf9d8a28 /src/pkg/path/filepath/path_test.go
parent03823b881cdfd4432ac1ea576677b6279bc6bb74 (diff)
downloadgo-8dce57e169255608b46bb563bb7de1581908aea6.tar.xz
os: new FileInfo, FileMode types + update tree
R=golang-dev, r, r, gri, bradfitz, iant, iant, nigeltao, n13m3y3r CC=golang-dev https://golang.org/cl/5416060
Diffstat (limited to 'src/pkg/path/filepath/path_test.go')
-rw-r--r--src/pkg/path/filepath/path_test.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/pkg/path/filepath/path_test.go b/src/pkg/path/filepath/path_test.go
index 983cc85c8e..fab5adc102 100644
--- a/src/pkg/path/filepath/path_test.go
+++ b/src/pkg/path/filepath/path_test.go
@@ -318,7 +318,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 {
@@ -326,8 +326,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++
}
})
@@ -338,7 +339,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.
@@ -600,7 +601,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) {