From b7e9d22528abec3529d2a28fd59beaae5e21023c Mon Sep 17 00:00:00 2001 From: Alex Brainman Date: Tue, 20 Dec 2011 11:53:24 +1100 Subject: [PATCH] net/http: test should not leave tmp files behind on windows R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5496067 --- src/pkg/net/http/request_test.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pkg/net/http/request_test.go b/src/pkg/net/http/request_test.go index 2a9c7ea28b..7b78645169 100644 --- a/src/pkg/net/http/request_test.go +++ b/src/pkg/net/http/request_test.go @@ -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) } } -- 2.50.0