diff options
| author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-06 19:49:01 +0000 |
|---|---|---|
| committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-06 19:49:01 +0000 |
| commit | 0ce10ea1348e9afd5d0eec6bca986bfe58bac5ac (patch) | |
| tree | 39530b071991b2326f881b2a30a2d82d6c133fd6 /libgo/go/path/filepath | |
| parent | 57a8bf1b0c6057ccbacb0cf79eb84d1985c2c1fe (diff) | |
| download | ppe42-gcc-0ce10ea1348e9afd5d0eec6bca986bfe58bac5ac.tar.gz ppe42-gcc-0ce10ea1348e9afd5d0eec6bca986bfe58bac5ac.zip | |
libgo: Update to October 24 version of master library.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204466 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/path/filepath')
| -rw-r--r-- | libgo/go/path/filepath/match.go | 6 | ||||
| -rw-r--r-- | libgo/go/path/filepath/match_test.go | 5 | ||||
| -rw-r--r-- | libgo/go/path/filepath/path_test.go | 30 | ||||
| -rw-r--r-- | libgo/go/path/filepath/path_unix.go | 2 |
4 files changed, 33 insertions, 10 deletions
diff --git a/libgo/go/path/filepath/match.go b/libgo/go/path/filepath/match.go index db8b0260ca8..3d84145d7f8 100644 --- a/libgo/go/path/filepath/match.go +++ b/libgo/go/path/filepath/match.go @@ -132,6 +132,12 @@ func matchChunk(chunk, s string) (rest string, ok bool, err error) { r, n := utf8.DecodeRuneInString(s) s = s[n:] chunk = chunk[1:] + // We can't end right after '[', we're expecting at least + // a closing bracket and possibly a caret. + if len(chunk) == 0 { + err = ErrBadPattern + return + } // possibly negated negated := chunk[0] == '^' if negated { diff --git a/libgo/go/path/filepath/match_test.go b/libgo/go/path/filepath/match_test.go index 1095cc5c454..6a2fd927e41 100644 --- a/libgo/go/path/filepath/match_test.go +++ b/libgo/go/path/filepath/match_test.go @@ -65,6 +65,11 @@ var matchTests = []MatchTest{ {"[-x]", "a", false, ErrBadPattern}, {"\\", "a", false, ErrBadPattern}, {"[a-b-c]", "a", false, ErrBadPattern}, + {"[", "a", false, ErrBadPattern}, + {"[^", "a", false, ErrBadPattern}, + {"[^bc", "a", false, ErrBadPattern}, + {"a[", "a", false, nil}, + {"a[", "ab", false, ErrBadPattern}, {"*x", "xxx", true, nil}, } diff --git a/libgo/go/path/filepath/path_test.go b/libgo/go/path/filepath/path_test.go index 607bfed11ba..3a6e83d8fad 100644 --- a/libgo/go/path/filepath/path_test.go +++ b/libgo/go/path/filepath/path_test.go @@ -107,6 +107,9 @@ func TestClean(t *testing.T) { } } + if testing.Short() { + t.Skip("skipping malloc count in short mode") + } if runtime.GOMAXPROCS(0) > 1 { t.Log("skipping AllocsPerRun checks; GOMAXPROCS>1") return @@ -633,6 +636,10 @@ func simpleJoin(dir, path string) string { } func TestEvalSymlinks(t *testing.T) { + if runtime.GOOS == "plan9" { + t.Skip("Skipping test: symlinks don't exist under Plan 9") + } + tmpDir, err := ioutil.TempDir("", "evalsymlink") if err != nil { t.Fatal("creating temp dir:", err) @@ -926,28 +933,33 @@ func TestDriveLetterInEvalSymlinks(t *testing.T) { differently. func TestBug3486(t *testing.T) { // http://code.google.com/p/go/issues/detail?id=3486 - root, err := filepath.EvalSymlinks(runtime.GOROOT()) + root, err := filepath.EvalSymlinks(runtime.GOROOT() + "/test") if err != nil { t.Fatal(err) } - lib := filepath.Join(root, "lib") - src := filepath.Join(root, "src") - seenSrc := false + bugs := filepath.Join(root, "bugs") + ken := filepath.Join(root, "ken") + seenBugs := false + seenKen := false filepath.Walk(root, func(pth string, info os.FileInfo, err error) error { if err != nil { t.Fatal(err) } switch pth { - case lib: + case bugs: + seenBugs = true return filepath.SkipDir - case src: - seenSrc = true + case ken: + if !seenBugs { + t.Fatal("filepath.Walk out of order - ken before bugs") + } + seenKen = true } return nil }) - if !seenSrc { - t.Fatalf("%q not seen", src) + if !seenKen { + t.Fatalf("%q not seen", ken) } } diff --git a/libgo/go/path/filepath/path_unix.go b/libgo/go/path/filepath/path_unix.go index cff7b2c65c5..d927b342be0 100644 --- a/libgo/go/path/filepath/path_unix.go +++ b/libgo/go/path/filepath/path_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin freebsd linux netbsd openbsd +// +build darwin dragonfly freebsd linux netbsd openbsd package filepath |

