MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestGetCode

Function TestGetCode

pkg/errors/errors_test.go:156–169  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

154}
155
156func TestGetCode(t *testing.T) {
157 err := NewError(ErrCodeUnexpectedToken, "test", models.Location{})
158
159 code := GetCode(err)
160 if code != ErrCodeUnexpectedToken {
161 t.Errorf("GetCode() = %v, want %v", code, ErrCodeUnexpectedToken)
162 }
163
164 // Test with nil
165 code = GetCode(nil)
166 if code != "" {
167 t.Errorf("GetCode(nil) = %v, want empty string", code)
168 }
169}
170
171func TestError_FormatContext(t *testing.T) {
172 tests := []struct {

Callers

nothing calls this directly

Calls 3

GetCodeFunction · 0.85
NewErrorFunction · 0.70
ErrorfMethod · 0.65

Tested by

no test coverage detected