MCPcopy Create free account
hub / github.com/AfterShip/clickhouse-sql-parser / TestWalk_SimpleNodeCounting

Function TestWalk_SimpleNodeCounting

parser/walk_test.go:170–184  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

168}
169
170func TestWalk_SimpleNodeCounting(t *testing.T) {
171 sql := `SELECT a FROM table1`
172 parser := NewParser(sql)
173 stmts, err := parser.ParseStmts()
174 require.NoError(t, err)
175
176 var nodeCount int
177 Walk(stmts[0], func(node Expr) bool {
178 nodeCount++
179 return true
180 })
181
182 require.Greater(t, nodeCount, 0, "Walk should visit nodes")
183 require.Greater(t, nodeCount, 3, "Should visit at least SELECT, column, table nodes")
184}
185
186func TestFind_NoMatch(t *testing.T) {
187 sql := `SELECT a FROM table1`

Callers

nothing calls this directly

Calls 3

ParseStmtsMethod · 0.95
NewParserFunction · 0.85
WalkFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…