github.com/pubgo/xprocess@v0.1.11/xutil/util_test.go (about) 1 package xutil 2 3 import ( 4 "net/http" 5 "testing" 6 7 "github.com/pubgo/xerror" 8 "github.com/stretchr/testify/assert" 9 ) 10 11 type a1 struct { 12 a int 13 } 14 15 func a1Test() *a1 { 16 return &a1{} 17 } 18 19 func a2Test() *a1 { 20 return nil 21 } 22 23 func a3Test() a1 { 24 return a1{} 25 } 26 27 func TestAsync(t *testing.T) { 28 defer xerror.RespExit() 29 30 var vfn = FuncRaw(http.Get) 31 rfn := vfn("https://www.cnblogs.com") 32 assert.Equal(t, len(rfn), 2) 33 }