(t *testing.T)
| 208 | } |
| 209 | |
| 210 | func TestClickHouseFinalRoundtrip(t *testing.T) { |
| 211 | input := `SELECT * FROM orders FINAL` |
| 212 | tree, err := parser.ParseWithDialect(input, keywords.DialectClickHouse) |
| 213 | if err != nil { |
| 214 | t.Fatalf("unexpected parse error: %v", err) |
| 215 | } |
| 216 | if len(tree.Statements) == 0 { |
| 217 | t.Fatal("expected at least one statement") |
| 218 | } |
| 219 | sel, ok := tree.Statements[0].(*ast.SelectStatement) |
| 220 | if !ok { |
| 221 | t.Fatalf("expected SelectStatement, got %T", tree.Statements[0]) |
| 222 | } |
| 223 | got := sel.SQL() |
| 224 | if !containsFINAL(got) { |
| 225 | t.Errorf("SQL() round-trip output does not contain FINAL; got: %q", got) |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | // containsFINAL reports whether s contains the uppercase keyword FINAL as a |
| 230 | // whole word. A simple strings.Contains is sufficient because SQL() always |
nothing calls this directly
no test coverage detected