MCPcopy Index your code
hub / github.com/expr-lang/expr / TestFind

Function TestFind

ast/find_test.go:11–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestFind(t *testing.T) {
12 left := &ast.IdentifierNode{
13 Value: "a",
14 }
15 var root ast.Node = &ast.BinaryNode{
16 Operator: "+",
17 Left: left,
18 Right: &ast.IdentifierNode{
19 Value: "b",
20 },
21 }
22
23 x := ast.Find(root, func(node ast.Node) bool {
24 if n, ok := node.(*ast.IdentifierNode); ok {
25 return n.Value == "a"
26 }
27 return false
28 })
29
30 require.Equal(t, left, x)
31}

Callers

nothing calls this directly

Calls 2

FindFunction · 0.92
EqualFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…