1 Star 1 Fork 0

字符尚云-serverless / gzcloud

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
gzz_go1.13_test.go 559 Bytes
一键复制 编辑 原始数据 按行查看 历史
傅长路 提交于 2020-07-24 10:50 . 1、同步echo
package gz
import (
"errors"
"net/http"
"testing"
"github.com/stretchr/testify/assert"
)
func TestHTTPError_Unwrap(t *testing.T) {
t.Run("non-internal", func(t *testing.T) {
err := NewHTTPError(http.StatusBadRequest, map[string]interface{}{
"code": 12,
})
assert.Nil(t, errors.Unwrap(err))
})
t.Run("internal", func(t *testing.T) {
err := NewHTTPError(http.StatusBadRequest, map[string]interface{}{
"code": 12,
})
err.SetInternal(errors.New("internal error"))
assert.Equal(t, "internal error", errors.Unwrap(err).Error())
})
}
Go
1
https://gitee.com/gzcloud/gzcloud.git
git@gitee.com:gzcloud/gzcloud.git
gzcloud
gzcloud
gzcloud
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891