Commit 010bca63 authored by guangxuli's avatar guangxuli

if test succ remove the tmp file

parent 9e1960c5
...@@ -20,6 +20,7 @@ import ( ...@@ -20,6 +20,7 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"os"
"reflect" "reflect"
"strings" "strings"
"syscall" "syscall"
...@@ -308,6 +309,11 @@ func TestDumpReaderToFile(t *testing.T) { ...@@ -308,6 +309,11 @@ func TestDumpReaderToFile(t *testing.T) {
} }
defer syscall.Unlink(tempFile.Name()) defer syscall.Unlink(tempFile.Name())
defer tempFile.Close() defer tempFile.Close()
defer func() {
if !t.Failed() {
os.Remove(tempFile.Name())
}
}()
err = DumpReaderToFile(strings.NewReader(testString), tempFile.Name()) err = DumpReaderToFile(strings.NewReader(testString), tempFile.Name())
if err != nil { if err != nil {
t.Errorf("error in DumpReaderToFile: %v", err) t.Errorf("error in DumpReaderToFile: %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