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

Function TestError_WithHint

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

Source from the content-addressed store, hash-verified

105}
106
107func TestError_WithHint(t *testing.T) {
108 err := NewError(ErrCodeUnexpectedToken, "unexpected token", models.Location{Line: 1, Column: 5})
109 err.WithHint("This is a helpful hint")
110
111 if err.Hint != "This is a helpful hint" {
112 t.Errorf("WithHint() failed to set hint, got: %s", err.Hint)
113 }
114
115 output := err.Error()
116 if !strings.Contains(output, "Hint: This is a helpful hint") {
117 t.Errorf("Error output should contain hint, got: %s", output)
118 }
119}
120
121func TestNewError(t *testing.T) {
122 location := models.Location{Line: 5, Column: 10}

Callers

nothing calls this directly

Calls 4

WithHintMethod · 0.95
ErrorMethod · 0.95
NewErrorFunction · 0.70
ErrorfMethod · 0.65

Tested by

no test coverage detected