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

Function TestRun_InnerMethodWithError

vm/vm_test.go:238–252  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

236}
237
238func TestRun_InnerMethodWithError(t *testing.T) {
239 input := `InnerEnv.WillError("yes")`
240
241 tree, err := parser.Parse(input)
242 require.NoError(t, err)
243
244 env := ErrorEnv{}
245 funcConf := conf.New(env)
246 program, err := compiler.Compile(tree, funcConf)
247 require.NoError(t, err)
248
249 out, err := vm.Run(program, env)
250 require.EqualError(t, err, "inner error (1:10)\n | InnerEnv.WillError(\"yes\")\n | .........^")
251 require.Equal(t, nil, out)
252}
253
254func TestRun_InnerMethodWithError_NilSafe(t *testing.T) {
255 input := `InnerEnv?.WillError("yes")`

Callers

nothing calls this directly

Calls 7

ParseFunction · 0.92
NoErrorFunction · 0.92
NewFunction · 0.92
CompileFunction · 0.92
RunFunction · 0.92
EqualErrorFunction · 0.92
EqualFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…