2016-07-10 20:58:43 +08:00
|
|
|
package torrent
|
|
|
|
|
|
|
|
import (
|
2017-09-18 10:14:16 +08:00
|
|
|
"io/ioutil"
|
|
|
|
"log"
|
2016-07-10 20:58:43 +08:00
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2017-09-18 10:14:16 +08:00
|
|
|
var tempDir string
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
log.SetFlags(log.LstdFlags | log.Llongfile)
|
|
|
|
var err error
|
|
|
|
tempDir, err = ioutil.TempDir("", "torrent.test")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-10 20:58:43 +08:00
|
|
|
func TestMain(m *testing.M) {
|
|
|
|
code := m.Run()
|
2017-09-18 10:14:16 +08:00
|
|
|
os.RemoveAll(tempDir)
|
2016-07-10 20:58:43 +08:00
|
|
|
// select {}
|
|
|
|
os.Exit(code)
|
|
|
|
}
|