Commit 3a3f672e authored by Mohit Agarwal's avatar Mohit Agarwal Committed by Ian Lance Taylor

os: cleanup directories created by TestLongPath

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/32892Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 8a2a9993
......@@ -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)
}
}
}
......
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