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

Function TestParseContext_DeepNesting

pkg/sql/parser/context_test.go:402–421  ·  view source on GitHub ↗

TestParseContext_DeepNesting verifies context checks with deeply nested expressions

(t *testing.T)

Source from the content-addressed store, hash-verified

400
401// TestParseContext_DeepNesting verifies context checks with deeply nested expressions
402func TestParseContext_DeepNesting(t *testing.T) {
403 ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
404 defer cancel()
405
406 // Create a query with multiple conditions
407 sql := "SELECT * FROM users WHERE a = 1"
408 tokens := tokenizeSQL(t, sql)
409
410 p := NewParser()
411 defer p.Release()
412
413 ast, err := p.ParseContext(ctx, tokens)
414 if err != nil {
415 t.Fatalf("ParseContext() with nested expressions error = %v", err)
416 }
417
418 if ast == nil {
419 t.Error("Expected AST but got nil")
420 }
421}
422
423// TestParseContext_EmptyTokens verifies handling of empty token list
424func TestParseContext_EmptyTokens(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