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

Function TestVM_EnvNotCallable

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

Source from the content-addressed store, hash-verified

1513}
1514
1515func TestVM_EnvNotCallable(t *testing.T) {
1516 // $env is the environment, not a function.
1517 env := map[string]any{
1518 "ok": true,
1519 }
1520
1521 code := `$env('' matches ' '? : now().UTC(g))`
1522 _, err := expr.Compile(code, expr.Env(env))
1523 require.Error(t, err)
1524 require.Contains(t, err.Error(), "is not callable")
1525}
1526
1527func TestVM_OpCall_InvalidNumberOfArguments(t *testing.T) {
1528 // Test that the VM validates argument count at runtime.

Callers

nothing calls this directly

Calls 5

CompileFunction · 0.92
EnvStruct · 0.92
ErrorFunction · 0.92
ContainsFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…