MCPcopy Create free account
hub / github.com/expr-lang/expr / TestOptimize_sum_array_3

Function TestOptimize_sum_array_3

optimizer/sum_array_test.go:54–72  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

52}
53
54func TestOptimize_sum_array_3(t *testing.T) {
55 tree, err := parser.Parse(`sum([a, b, c])`)
56 require.NoError(t, err)
57
58 err = optimizer.Optimize(&tree.Node, nil)
59 require.NoError(t, err)
60
61 expected := &ast.BinaryNode{
62 Operator: "+",
63 Left: &ast.IdentifierNode{Value: "a"},
64 Right: &ast.BinaryNode{
65 Operator: "+",
66 Left: &ast.IdentifierNode{Value: "b"},
67 Right: &ast.IdentifierNode{Value: "c"},
68 },
69 }
70
71 assert.Equal(t, ast.Dump(expected), ast.Dump(tree.Node))
72}

Callers

nothing calls this directly

Calls 5

ParseFunction · 0.92
NoErrorFunction · 0.92
OptimizeFunction · 0.92
EqualFunction · 0.92
DumpFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…