]> Cypherpunks repositories - gostls13.git/commitdiff
os: cleanup directories created by TestLongPath
authorMohit Agarwal <mohit@sdf.org>
Tue, 8 Nov 2016 12:16:10 +0000 (17:46 +0530)
committerIan Lance Taylor <iant@golang.org>
Tue, 8 Nov 2016 15:41:59 +0000 (15:41 +0000)
Add tmpdir as a parameter to the closure otherwise the subsequent
modifications to tmpdir causes only the last subdirectory to be
removed.

Additionally, add the missing argument for the t.Fatalf call.

Change-Id: I3df53f9051f7ea40cf3f846d47d9cefe445e9b9d
Reviewed-on: https://go-review.googlesource.com/32892
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/os/os_test.go

index 705c44d14382e0720acd40fe2d1ca28edf388d6b..eb4454411f930a70eeb705263fa2dfe4d032f6a7 100644 (file)
@@ -1703,11 +1703,11 @@ func TestReadAtEOF(t *testing.T) {
 
 func TestLongPath(t *testing.T) {
        tmpdir := newDir("TestLongPath", t)
-       defer func() {
-               if err := RemoveAll(tmpdir); err != nil {
+       defer func(d string) {
+               if err := RemoveAll(d); err != nil {
                        t.Fatalf("RemoveAll failed: %v", err)
                }
-       }()
+       }(tmpdir)
        for len(tmpdir) < 400 {
                tmpdir += "/dir3456789"
        }
@@ -1751,7 +1751,7 @@ func TestLongPath(t *testing.T) {
                        }
                }
                if err := Truncate(tmpdir+"/bar.txt", 0); err != nil {
-                       t.Fatalf("Truncate failed: %v")
+                       t.Fatalf("Truncate failed: %v", err)
                }
        }
 }