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

Function TestIssue401

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

Source from the content-addressed store, hash-verified

2319}
2320
2321func TestIssue401(t *testing.T) {
2322 program, err := expr.Compile("(a - b + c) / d", expr.AllowUndefinedVariables())
2323 require.NoError(t, err, "compile error")
2324
2325 output, err := expr.Run(program, map[string]any{
2326 "a": 1,
2327 "b": 2,
2328 "c": 3,
2329 "d": 4,
2330 })
2331 require.NoError(t, err, "run error")
2332 require.Equal(t, 0.5, output)
2333}
2334
2335func TestEval_slices_out_of_bound(t *testing.T) {
2336 tests := []struct {

Callers

nothing calls this directly

Calls 5

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