test: add test case

This commit is contained in:
fatedier
2017-03-27 23:46:38 +08:00
parent 30aeaf968e
commit a0c83bdb78
7 changed files with 86 additions and 9 deletions

View File

@@ -0,0 +1,16 @@
package errors
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestPanicToError(t *testing.T) {
assert := assert.New(t)
err := PanicToError(func() {
panic("test error")
})
assert.Contains(err.Error(), "test error")
}