MCPcopy Create free account
hub / github.com/expr-lang/expr / TestEnvFieldMethods

Function TestEnvFieldMethods

test/issues/840/issue_test.go:10–26  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestEnvFieldMethods(t *testing.T) {
11 program, err := expr.Compile(`Func() + Int`, expr.Env(&Env{}))
12 require.NoError(t, err)
13
14 env := &Env{}
15 env.Func = func() int {
16 return 40
17 }
18 env.EmbeddedEnv = &EmbeddedEnv{
19 Int: 2,
20 }
21
22 out, err := expr.Run(program, env)
23 require.NoError(t, err)
24
25 require.Equal(t, 42, out)
26}
27
28type Env struct {
29 *EmbeddedEnv

Callers

nothing calls this directly

Calls 5

CompileFunction · 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…