MCPcopy
hub / github.com/gogf/gf / Test_Error_WithCodeMessage

Function Test_Error_WithCodeMessage

errors/gerror/gerror_z_unit_test.go:712–724  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

710}
711
712func Test_Error_WithCodeMessage(t *testing.T) {
713 gtest.C(t, func(t *gtest.T) {
714 // Test Error.Error() when text is empty but code has message
715 err := gerror.NewCode(gcode.CodeInternalError)
716 t.Assert(err.Error(), "Internal Error")
717 })
718 gtest.C(t, func(t *gtest.T) {
719 // Test Error.Error() when text is empty and code has message, with wrapped error
720 innerErr := errors.New("inner")
721 err := gerror.WrapCode(gcode.CodeInternalError, innerErr)
722 t.Assert(err.Error(), "Internal Error: inner")
723 })
724}
725
726func Test_Format_PlusS(t *testing.T) {
727 gtest.C(t, func(t *gtest.T) {

Callers

nothing calls this directly

Calls 6

CFunction · 0.92
NewCodeFunction · 0.92
WrapCodeFunction · 0.92
AssertMethod · 0.80
ErrorMethod · 0.65
NewMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…