(t *testing.T)
| 1513 | } |
| 1514 | |
| 1515 | func 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 | |
| 1527 | func TestVM_OpCall_InvalidNumberOfArguments(t *testing.T) { |
| 1528 | // Test that the VM validates argument count at runtime. |