mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
add ut cases for package gcode (#2307)
This commit is contained in:
@ -13,6 +13,13 @@ import (
|
||||
"github.com/gogf/gf/v2/test/gtest"
|
||||
)
|
||||
|
||||
func Test_Case(t *testing.T) {
|
||||
gtest.C(t, func(t *gtest.T) {
|
||||
t.Assert(gcode.CodeNil.String(), "-1")
|
||||
t.Assert(gcode.CodeInternalError.String(), "50:Internal Error")
|
||||
})
|
||||
}
|
||||
|
||||
func Test_Nil(t *testing.T) {
|
||||
gtest.C(t, func(t *gtest.T) {
|
||||
c := gcode.New(1, "custom error", "detailed description")
|
||||
@ -21,3 +28,11 @@ func Test_Nil(t *testing.T) {
|
||||
t.Assert(c.Detail(), "detailed description")
|
||||
})
|
||||
}
|
||||
|
||||
func Test_WithCode(t *testing.T) {
|
||||
gtest.C(t, func(t *gtest.T) {
|
||||
c := gcode.WithCode(gcode.CodeInternalError, "CodeInternalError")
|
||||
t.Assert(c.Code(), gcode.CodeInternalError.Code())
|
||||
t.Assert(c.Detail(), "CodeInternalError")
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user