]> Cypherpunks repositories - gostls13.git/commitdiff
os: return from TestRemoveAllWithMoreErrorThanReqSize when RemoveAll succeeds on...
authorConstantin Konstantinidis <constantinkonstantinidis@gmail.com>
Tue, 29 Oct 2019 08:19:35 +0000 (09:19 +0100)
committerBryan C. Mills <bcmills@google.com>
Tue, 29 Oct 2019 18:24:40 +0000 (18:24 +0000)
Also remove unused test hook.

Updates #35117

Change-Id: I6f05ba234fb09e4b44e77c1539c02d1aed49910a
Reviewed-on: https://go-review.googlesource.com/c/go/+/204060
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/os/path.go
src/os/removeall_test.go

index 9d7ecad79298ad06f57b4876d3b76280fee01f03..ba43ea352547b9e4018df73c55b2b8d9a6f9bc90 100644 (file)
@@ -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
index 0bf35751ce71931a91213ce53e17e1a6ad1c6735..8a71f687ed0d7ccfe30885c33fe2eb97e81d2d02 100644 (file)
@@ -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))