| 710 | } |
| 711 | |
| 712 | func 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 | |
| 726 | func Test_Format_PlusS(t *testing.T) { |
| 727 | gtest.C(t, func(t *gtest.T) { |