panicใฎใในใ - golang
2020-05-28
Goใงใใใใฏใ็บ็ใใใใฉใใใฎใในใใงใใ // Testing if testFunc calls panic. // e.g. // IsTestCallPanic(func(){ // <place test target here.> // }) func IsTestCallPanic(testFunc func()) (ok bool) { defer func() { if err := recover(); err == nil { ok = false } }() ok = true testFunc() return } // Test for test. func TestIsTestCallPanic(t *testing.T) { isCalled := IsTestCallPanic(func() { ...