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

Function TestFormatSQLInternal_ValidSQL

pkg/mcp/tools_internal_test.go:91–112  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

89}
90
91func TestFormatSQLInternal_ValidSQL(t *testing.T) {
92 data, err := formatSQLInternal("select id from users", 4, true, true)
93 if err != nil {
94 t.Fatalf("unexpected error: %v", err)
95 }
96 if _, ok := data["formatted_sql"]; !ok {
97 t.Error("expected formatted_sql key")
98 }
99 opts, ok := data["options"].(map[string]any)
100 if !ok {
101 t.Fatal("expected options to be map[string]any")
102 }
103 if opts["indent_size"] != 4 {
104 t.Errorf("expected indent_size=4, got %v", opts["indent_size"])
105 }
106 if opts["uppercase_keywords"] != true {
107 t.Errorf("expected uppercase_keywords=true")
108 }
109 if opts["add_semicolon"] != true {
110 t.Errorf("expected add_semicolon=true")
111 }
112}
113
114func TestFormatSQLInternal_InvalidSQL(t *testing.T) {
115 _, err := formatSQLInternal(")))((( @@@ !!!", 2, false, false)

Callers

nothing calls this directly

Calls 4

formatSQLInternalFunction · 0.85
FatalfMethod · 0.65
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected