This commit is contained in:
Liang Ding 2015-10-21 12:50:56 +08:00
parent 7772fcdb16
commit 0780cdb04f
2 changed files with 6 additions and 10 deletions

1
tmp/README.md Normal file
View File

@ -0,0 +1 @@
This directory is used to unit-test.

View File

@ -20,8 +20,7 @@ import (
"testing" "testing"
) )
var tempDir = "../" var testDir = "../tmp"
var testDir = filepath.Join(tempDir, "wide-test")
var packageName = filepath.Join(testDir, "test_zip") var packageName = filepath.Join(testDir, "test_zip")
func TestCreate(t *testing.T) { func TestCreate(t *testing.T) {
@ -57,19 +56,15 @@ func TestUnzip(t *testing.T) {
} }
func TestMain(m *testing.M) { func TestMain(m *testing.M) {
err := os.Mkdir(testDir, 0644)
if err != nil {
logger.Error(err)
os.Exit(-1)
}
logger.Info(testDir) logger.Info(testDir)
retCode := m.Run() retCode := m.Run()
// clean test data // clean test data
os.RemoveAll(testDir) os.RemoveAll(testDir + "/test_zip")
os.RemoveAll(testDir + "/util")
os.RemoveAll(testDir + "/file.go")
os.RemoveAll(testDir + "/test_zip.zip")
os.Exit(retCode) os.Exit(retCode)
} }