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

Function TestSQLFormatter_ErrorHandling

cmd/gosqlx/cmd/sql_formatter_test.go:482–497  ·  view source on GitHub ↗

TestSQLFormatter_ErrorHandling tests error handling

(t *testing.T)

Source from the content-addressed store, hash-verified

480
481// TestSQLFormatter_ErrorHandling tests error handling
482func TestSQLFormatter_ErrorHandling(t *testing.T) {
483 t.Run("empty AST", func(t *testing.T) {
484 formatter := NewSQLFormatter(FormatterOptions{
485 Indent: " ",
486 })
487
488 astObj := ast.NewAST()
489 defer ast.ReleaseAST(astObj)
490
491 output, err := formatter.Format(astObj)
492 // Empty AST should produce empty output or error
493 if err == nil && output != "" {
494 t.Errorf("Expected empty output for empty AST, got: %s", output)
495 }
496 })
497}
498
499// TestSQLFormatter_Options tests different formatter options
500func TestSQLFormatter_Options(t *testing.T) {

Callers

nothing calls this directly

Calls 6

FormatMethod · 0.95
NewASTFunction · 0.92
ReleaseASTFunction · 0.92
NewSQLFormatterFunction · 0.85
RunMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected