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

Function TestParseSQLWithDialect_SQLServerTop

pkg/transform/dialect_test.go:151–164  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

149}
150
151func TestParseSQLWithDialect_SQLServerTop(t *testing.T) {
152 tree, err := ParseSQLWithDialect("SELECT TOP 10 * FROM users", keywords.DialectSQLServer)
153 if err != nil {
154 t.Fatalf("parse: %v", err)
155 }
156 if len(tree.Statements) == 0 {
157 t.Fatal("no statements parsed")
158 }
159
160 got := FormatSQLWithDialect(tree.Statements[0], keywords.DialectSQLServer)
161 if !strings.Contains(got, "TOP 10") {
162 t.Errorf("expected TOP 10 preserved, got: %s", got)
163 }
164}
165
166func TestFormatSQLWithDialect_SQLServerOffset(t *testing.T) {
167 tree, err := ParseSQL("SELECT * FROM users ORDER BY id")

Callers

nothing calls this directly

Calls 4

ParseSQLWithDialectFunction · 0.85
FormatSQLWithDialectFunction · 0.85
FatalfMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected