diff --git a/errors/gcode/gcode_z_unit_test.go b/errors/gcode/gcode_z_unit_test.go index b8690455f34..7bbd5b254e3 100644 --- a/errors/gcode/gcode_z_unit_test.go +++ b/errors/gcode/gcode_z_unit_test.go @@ -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") + }) +}