1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 21:02:27 +08:00
Files
lancet/xerror/xerror_test.go
2022-03-17 10:57:35 +08:00

26 lines
469 B
Go

package xerror
import (
"strconv"
"testing"
"github.com/duke-git/lancet/v2/internal"
)
func TestUnwrap(t *testing.T) {
assert := internal.NewAssert(t, "TestUnwrap")
assert.Equal(42, Unwrap(strconv.Atoi("42")))
}
func TestUnwrapFail(t *testing.T) {
assert := internal.NewAssert(t, "TestUnwrapFail")
_, err := strconv.Atoi("4o2")
defer func() {
v := recover()
assert.Equal(err.Error(), v.(*strconv.NumError).Error())
}()
Unwrap(strconv.Atoi("4o2"))
}