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

Function TestParseContext_CTEWithContext

pkg/sql/parser/context_test.go:176–194  ·  view source on GitHub ↗

TestParseContext_CTEWithContext verifies CTE parsing with context

(t *testing.T)

Source from the content-addressed store, hash-verified

174
175// TestParseContext_CTEWithContext verifies CTE parsing with context
176func 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
197func TestParseContext_WindowFunctionsWithContext(t *testing.T) {

Callers

nothing calls this directly

Calls 6

ReleaseMethod · 0.95
ParseContextMethod · 0.95
tokenizeSQLFunction · 0.85
NewParserFunction · 0.70
FatalfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected