]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: test should not leave tmp files behind on windows
authorAlex Brainman <alex.brainman@gmail.com>
Tue, 20 Dec 2011 00:53:24 +0000 (11:53 +1100)
committerAlex Brainman <alex.brainman@gmail.com>
Tue, 20 Dec 2011 00:53:24 +0000 (11:53 +1100)
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5496067

src/pkg/net/http/request_test.go

index 2a9c7ea28b23448e3ad758789d6d9312e9844af4..7b78645169eb56d65fcc110d2a5c562d709a4067 100644 (file)
@@ -214,14 +214,16 @@ func validateTestMultipartContents(t *testing.T, req *Request, allMem bool) {
                        t.Error(n, " is *os.File, should not be")
                }
        }
-       fd := testMultipartFile(t, req, "filea", "filea.txt", fileaContents)
-       assertMem("filea", fd)
-       fd = testMultipartFile(t, req, "fileb", "fileb.txt", filebContents)
+       fda := testMultipartFile(t, req, "filea", "filea.txt", fileaContents)
+       defer fda.Close()
+       assertMem("filea", fda)
+       fdb := testMultipartFile(t, req, "fileb", "fileb.txt", filebContents)
+       defer fdb.Close()
        if allMem {
-               assertMem("fileb", fd)
+               assertMem("fileb", fdb)
        } else {
-               if _, ok := fd.(*os.File); !ok {
-                       t.Errorf("fileb has unexpected underlying type %T", fd)
+               if _, ok := fdb.(*os.File); !ok {
+                       t.Errorf("fileb has unexpected underlying type %T", fdb)
                }
        }