TestParseContext_CTEWithContext verifies CTE parsing with context
(t *testing.T)
| 174 | |
| 175 | // TestParseContext_CTEWithContext verifies CTE parsing with context |
| 176 | func TestParseContext_CTEWithContext(t *testing.T) { |
| 177 | ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) |
| 178 | defer cancel() |
| 179 | |
| 180 | sql := "WITH active_users AS (SELECT id, name FROM users WHERE active = true) SELECT * FROM active_users" |
| 181 | tokens := tokenizeSQL(t, sql) |
| 182 | |
| 183 | p := NewParser() |
| 184 | defer p.Release() |
| 185 | |
| 186 | ast, err := p.ParseContext(ctx, tokens) |
| 187 | if err != nil { |
| 188 | t.Fatalf("ParseContext() with CTE error = %v", err) |
| 189 | } |
| 190 | |
| 191 | if ast == nil { |
| 192 | t.Error("Expected AST but got nil") |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | // TestParseContext_WindowFunctionsWithContext verifies window function parsing with context |
| 197 | func TestParseContext_WindowFunctionsWithContext(t *testing.T) { |
nothing calls this directly
no test coverage detected