(t *testing.T)
| 2925 | } |
| 2926 | |
| 2927 | func TestDisableShortCircuit(t *testing.T) { |
| 2928 | count := 0 |
| 2929 | exprStr := "foo() or bar()" |
| 2930 | env := map[string]any{ |
| 2931 | "foo": func() bool { |
| 2932 | count++ |
| 2933 | return true |
| 2934 | }, |
| 2935 | "bar": func() bool { |
| 2936 | count++ |
| 2937 | return true |
| 2938 | }, |
| 2939 | } |
| 2940 | |
| 2941 | program, _ := expr.Compile(exprStr, expr.DisableShortCircuit()) |
| 2942 | got, _ := expr.Run(program, env) |
| 2943 | assert.Equal(t, 2, count) |
| 2944 | assert.True(t, got.(bool)) |
| 2945 | |
| 2946 | program, _ = expr.Compile(exprStr) |
| 2947 | got, _ = expr.Run(program, env) |
| 2948 | assert.Equal(t, 3, count) |
| 2949 | assert.True(t, got.(bool)) |
| 2950 | } |
| 2951 | |
| 2952 | func TestBytesLiteral(t *testing.T) { |
| 2953 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…