MCPcopy
hub / github.com/expr-lang/expr / TestOptimize_constant_folding_with_bools

Function TestOptimize_constant_folding_with_bools

optimizer/fold_test.go:42–52  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

40}
41
42func TestOptimize_constant_folding_with_bools(t *testing.T) {
43 tree, err := parser.Parse(`(true and false) or (true or false) or (false and false) or (true and (true == false))`)
44 require.NoError(t, err)
45
46 err = optimizer.Optimize(&tree.Node, nil)
47 require.NoError(t, err)
48
49 expected := &ast.BoolNode{Value: true}
50
51 assert.Equal(t, ast.Dump(expected), ast.Dump(tree.Node))
52}
53
54func TestOptimize_constant_folding_filter_filter(t *testing.T) {
55 tree, err := parser.Parse(`filter(filter(1..2, true), true)`)

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…