Commit f2dfbe98 authored by Constantin Konstantinidis's avatar Constantin Konstantinidis Committed by Bryan C. Mills

os: return from TestRemoveAllWithMoreErrorThanReqSize when RemoveAll succeeds on Windows

Also remove unused test hook.

Updates #35117

Change-Id: I6f05ba234fb09e4b44e77c1539c02d1aed49910a
Reviewed-on: https://go-review.googlesource.com/c/go/+/204060Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
parent 64533374
......@@ -58,9 +58,6 @@ func MkdirAll(path string, perm FileMode) error {
return nil
}
// removeAllTestHook is a hook for testing.
var removeAllTestHook = func(err error) error { return err }
// RemoveAll removes path and any children it contains.
// It removes everything it can but returns the first error
// it encounters. If the path does not exist, RemoveAll
......
......@@ -449,6 +449,11 @@ func TestRemoveAllWithMoreErrorThanReqSize(t *testing.T) {
return
}
if err == nil {
if runtime.GOOS == "windows" {
// Marking a directory as read-only in Windows does not prevent the RemoveAll
// from creating or removing files within it.
return
}
t.Fatal("RemoveAll(<read-only directory>) = nil; want error")
}
......@@ -458,13 +463,6 @@ func TestRemoveAllWithMoreErrorThanReqSize(t *testing.T) {
}
defer dir.Close()
if runtime.GOOS == "windows" {
// Marking a directory in Windows does not prevent the os package from
// creating or removing files within it.
// (See https://golang.org/issue/35042.)
return
}
names, _ := dir.Readdirnames(1025)
if len(names) < 1025 {
t.Fatalf("RemoveAll(<read-only directory>) unexpectedly removed %d read-only files from that directory", 1025-len(names))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment