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

Function TestDisableIfOperator_AllowsIfFunction

expr_test.go:86–95  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

84}
85
86func TestDisableIfOperator_AllowsIfFunction(t *testing.T) {
87 env := map[string]any{
88 "if": func(x int) int { return x + 1 },
89 }
90 program, err := expr.Compile("if(41)", expr.Env(env), expr.DisableIfOperator())
91 require.NoError(t, err)
92 out, err := expr.Run(program, env)
93 require.NoError(t, err)
94 assert.Equal(t, 42, out)
95}
96
97func ExampleEnv() {
98 type Segment struct {

Callers

nothing calls this directly

Calls 6

CompileFunction · 0.92
EnvStruct · 0.92
DisableIfOperatorFunction · 0.92
NoErrorFunction · 0.92
RunFunction · 0.92
EqualFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…