(t *testing.T)
| 84 | } |
| 85 | |
| 86 | func 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 | |
| 97 | func ExampleEnv() { |
| 98 | type Segment struct { |