go1.4 TestMain example
package example_test
import (
"os"
"testing"
)
func TestA(t *testing.T) {
}
func TestB(t *testing.T) {
}
func setup() {
println("setup")
}
func teardown() {
println("teardown")
}
func TestMain(m *testing.M) {
setup()
ret := m.Run()
if ret == 0 {
teardown()
}
os.Exit(ret)
}