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

Function TestFormatSQLWithDialect_SQLServer

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

Source from the content-addressed store, hash-verified

28}
29
30func TestFormatSQLWithDialect_SQLServer(t *testing.T) {
31 tree, err := ParseSQL("SELECT * FROM users u")
32 if err != nil {
33 t.Fatalf("parse: %v", err)
34 }
35 stmt := tree.Statements[0]
36 if err := Apply(stmt, SetLimit(100)); err != nil {
37 t.Fatalf("apply: %v", err)
38 }
39
40 got := FormatSQLWithDialect(stmt, keywords.DialectSQLServer)
41 if !strings.Contains(got, "TOP 100") {
42 t.Errorf("sqlserver: expected TOP 100, got: %s", got)
43 }
44 if strings.Contains(got, "LIMIT") {
45 t.Errorf("sqlserver: should not contain LIMIT, got: %s", got)
46 }
47}
48
49func TestFormatSQLWithDialect_Oracle(t *testing.T) {
50 tree, err := ParseSQL("SELECT * FROM users u")

Callers

nothing calls this directly

Calls 6

ParseSQLFunction · 0.85
ApplyFunction · 0.85
SetLimitFunction · 0.85
FormatSQLWithDialectFunction · 0.85
FatalfMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected