errors_test.go 244 B

12345678910111213141516
  1. package errors
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. func TestPanicToError(t *testing.T) {
  7. assert := assert.New(t)
  8. err := PanicToError(func() {
  9. panic("test error")
  10. })
  11. assert.Contains(err.Error(), "test error")
  12. }