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

Function TestVM_OpCall_InvalidNumberOfArguments_Variadic

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

Source from the content-addressed store, hash-verified

1541}
1542
1543func TestVM_OpCall_InvalidNumberOfArguments_Variadic(t *testing.T) {
1544 // Test variadic function with too few arguments.
1545 program, err := expr.Compile(`fn()`)
1546 require.NoError(t, err)
1547
1548 // Run with a variadic function that requires at least 1 argument
1549 env := map[string]any{
1550 "fn": func(first int, rest ...int) int { return first },
1551 }
1552
1553 _, err = expr.Run(program, env)
1554 require.Error(t, err)
1555 require.Contains(t, err.Error(), "invalid number of arguments")
1556}

Callers

nothing calls this directly

Calls 6

CompileFunction · 0.92
NoErrorFunction · 0.92
RunFunction · 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…