aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/path/filepath/path_test.go
diff options
context:
space:
mode:
authorJan Mercl <befelemepeseveze@gmail.com>2012-06-02 13:00:09 -0400
committerRuss Cox <rsc@golang.org>2012-06-02 13:00:09 -0400
commit2b57a87678caa3adebc3254b1a54d18ab2ada941 (patch)
tree054b867da23dfb2c1dd20365e1152d5e5a491664 /src/pkg/path/filepath/path_test.go
parentd87bc2f0c0e12672592e7dbf30d2c439376891d9 (diff)
downloadgo-2b57a87678caa3adebc3254b1a54d18ab2ada941.tar.xz
path/filepath: implement documented SkipDir behavior
Currently walk() doesn't check for err == SkipDir when iterating a directory list, but such promise is made in the docs for WalkFunc. Fixes #3486. R=rsc, r CC=golang-dev https://golang.org/cl/6257059
Diffstat (limited to 'src/pkg/path/filepath/path_test.go')
-rw-r--r--src/pkg/path/filepath/path_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/pkg/path/filepath/path_test.go b/src/pkg/path/filepath/path_test.go
index e4b4da43cb..e6097d5146 100644
--- a/src/pkg/path/filepath/path_test.go
+++ b/src/pkg/path/filepath/path_test.go
@@ -874,3 +874,26 @@ func TestDriveLetterInEvalSymlinks(t *testing.T) {
t.Errorf("Results of EvalSymlinks do not match: %q and %q", flp, fup)
}
}
+
+func TestBug3486(t *testing.T) { // http://code.google.com/p/go/issues/detail?id=3486
+ root := os.Getenv("GOROOT")
+ lib := filepath.Join(root, "lib")
+ src := filepath.Join(root, "src")
+ seenSrc := false
+ filepath.Walk(root, func(pth string, info os.FileInfo, err error) error {
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ switch pth {
+ case lib:
+ return filepath.SkipDir
+ case src:
+ seenSrc = true
+ }
+ return nil
+ })
+ if !seenSrc {
+ t.Fatalf("%q not seen", src)
+ }
+}