MCPcopy Index your code
hub / github.com/expr-lang/expr / TestOperatorDependsOnEnv

Function TestOperatorDependsOnEnv

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

Source from the content-addressed store, hash-verified

2575}
2576
2577func TestOperatorDependsOnEnv(t *testing.T) {
2578 env := map[string]any{
2579 "plus": func(a, b int) int {
2580 return 42
2581 },
2582 }
2583 program, err := expr.Compile(`1 + 2`, expr.Operator("+", "plus"), expr.Env(env))
2584 require.NoError(t, err)
2585
2586 out, err := expr.Run(program, env)
2587 require.NoError(t, err)
2588 assert.Equal(t, 42, out)
2589}
2590
2591func TestIssue624(t *testing.T) {
2592 type tag struct {

Callers

nothing calls this directly

Calls 6

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