修复相关BUG + 增加单元测试, 覆盖率100%
This commit is contained in:
27
http_code_test.go
Normal file
27
http_code_test.go
Normal file
@ -0,0 +1,27 @@
|
||||
// Package consts ...
|
||||
//
|
||||
// Description : consts ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2025-04-20 15:29
|
||||
package consts
|
||||
|
||||
import (
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_newHttpCodeData(t *testing.T) {
|
||||
Convey("newHttpCode 验证", t, func() {
|
||||
hCode := newHttpCodeData(499)
|
||||
So(hCode.Code, ShouldEqual, 499)
|
||||
So(hCode.Desc, ShouldEqual, "client request timeout")
|
||||
So(hCode.Value, ShouldEqual, 499)
|
||||
hCode = newHttpCodeData(4990)
|
||||
So(hCode.Code, ShouldEqual, 4990)
|
||||
So(strings.Contains(hCode.Desc, "unknown error"), ShouldBeTrue)
|
||||
So(hCode.Value, ShouldEqual, 4990)
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user