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

Function TestPutExpressionNestedDeep

pkg/sql/ast/coverage_test.go:261–282  ·  view source on GitHub ↗

TestPutExpressionNestedDeep tests deeply nested expressions

(t *testing.T)

Source from the content-addressed store, hash-verified

259
260// TestPutExpressionNestedDeep tests deeply nested expressions
261func TestPutExpressionNestedDeep(t *testing.T) {
262 // Create a moderately nested binary expression tree
263 var createNested func(depth int) Expression
264 createNested = func(depth int) Expression {
265 if depth == 0 {
266 return &Identifier{Name: "leaf"}
267 }
268 return &BinaryExpression{
269 Left: createNested(depth - 1),
270 Right: createNested(depth - 1),
271 Operator: "+",
272 }
273 }
274
275 // Test with various depths
276 for _, depth := range []int{5, 10, 15} {
277 t.Run("depth_"+string(rune('0'+depth/10))+string(rune('0'+depth%10)), func(t *testing.T) {
278 expr := createNested(depth)
279 PutExpression(expr) // Should not stack overflow
280 })
281 }
282}
283
284// TestSpanMethods tests Span() methods on various AST nodes
285func TestSpanMethods(t *testing.T) {

Callers

nothing calls this directly

Calls 2

PutExpressionFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected