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

Function TestExpr_calls_with_nil

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

Source from the content-addressed store, hash-verified

1607}
1608
1609func 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
1632func TestExpr_call_float_arg_func_with_int(t *testing.T) {
1633 env := map[string]any{

Callers

nothing calls this directly

Calls 8

NilFunction · 0.92
CompileFunction · 0.92
EnvStruct · 0.92
OperatorFunction · 0.92
AllowUndefinedVariablesFunction · 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…