package demo
// what exactly go test do
// 一個進程跑多個函數(shù)測試
// 每個測試函數(shù)一個協(xié)程
// 但是這些協(xié)程是串行跑的
import (
"fmt"
// "os"
"runtime"
"testing"
"time"
)
func GetGoID() {
var buf [1024]byte
n := runtime.Stack(buf[:], false)
fmt.Println(string(buf[:n]))
}
func TestAdd(t *testing.T) {
GetGoID()
// c := Add(1, 1)
// if c != 2 {
// t.Fatal("")
// }
// fmt.Printf("[TestAdd] pid: %d\n", os.Getpid())
time.Sleep(time.Second * 3)
fmt.Println("TestAdd end")
}
func TestAfter(t *testing.T) {
GetGoID()
// fmt.Println("before TestAfter")
// time.Sleep(time.Second * 3)
// fmt.Printf("[TestAfter] pid: %d\n", os.Getpid())
fmt.Println("end TestAfter")
}