| 66 | } |
| 67 | |
| 68 | func TestFormatSQLWithDialect_EmptyDialect(t *testing.T) { |
| 69 | tree, err := ParseSQL("SELECT * FROM users") |
| 70 | if err != nil { |
| 71 | t.Fatalf("parse: %v", err) |
| 72 | } |
| 73 | stmt := tree.Statements[0] |
| 74 | if err := Apply(stmt, SetLimit(10)); err != nil { |
| 75 | t.Fatalf("apply: %v", err) |
| 76 | } |
| 77 | |
| 78 | // Empty dialect = generic = LIMIT |
| 79 | got := FormatSQLWithDialect(stmt, "") |
| 80 | if !strings.Contains(got, "LIMIT 10") { |
| 81 | t.Errorf("generic: expected LIMIT 10, got: %s", got) |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | func TestFormatSQLWithDialect_Pagination(t *testing.T) { |
| 86 | tests := []struct { |