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

Function TestFormatErrorWithExample

pkg/errors/formatter_test.go:335–360  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

333}
334
335func TestFormatErrorWithExample(t *testing.T) {
336 got := FormatErrorWithExample(
337 ErrCodeExpectedToken,
338 "expected FROM, got FORM",
339 models.Location{Line: 1, Column: 10},
340 "SELECT * FORM users",
341 4,
342 "SELECT * FORM users",
343 "SELECT * FROM users",
344 )
345
346 requiredParts := []string{
347 "expected FROM, got FORM",
348 "Wrong:",
349 "SELECT * FORM users",
350 "Correct:",
351 "SELECT * FROM users",
352 "Hint:",
353 }
354
355 for _, part := range requiredParts {
356 if !strings.Contains(got, part) {
357 t.Errorf("FormatErrorWithExample() missing %q\nGot:\n%s", part, got)
358 }
359 }
360}
361
362func TestFormatContextWindow(t *testing.T) {
363 sql := `SELECT id, name, email

Callers

nothing calls this directly

Calls 2

FormatErrorWithExampleFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected