(t *testing.T)
| 1607 | } |
| 1608 | |
| 1609 | func TestExpr_calls_with_nil(t *testing.T) { |
| 1610 | env := map[string]any{ |
| 1611 | "equals": func(a, b any) any { |
| 1612 | assert.Nil(t, a, "a is not nil") |
| 1613 | assert.Nil(t, b, "b is not nil") |
| 1614 | return a == b |
| 1615 | }, |
| 1616 | "is": mock.Is{}, |
| 1617 | } |
| 1618 | |
| 1619 | p, err := expr.Compile( |
| 1620 | "a == nil && equals(b, nil) && is.Nil(c)", |
| 1621 | expr.Env(env), |
| 1622 | expr.Operator("==", "equals"), |
| 1623 | expr.AllowUndefinedVariables(), |
| 1624 | ) |
| 1625 | require.NoError(t, err) |
| 1626 | |
| 1627 | out, err := expr.Run(p, env) |
| 1628 | require.NoError(t, err) |
| 1629 | require.Equal(t, true, out) |
| 1630 | } |
| 1631 | |
| 1632 | func TestExpr_call_float_arg_func_with_int(t *testing.T) { |
| 1633 | env := map[string]any{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…