I have a function I want to test. It takes 6 parameters. If I call helper:assert-throws-error, I get a “Too few args” error message. The error is actually occurring at line 295.
I think this might be a bug because xdmp:apply seems to require the $params be itemized. Instead of this
let $params := (‘1’, ‘2’, ‘3’)
return xdmp:apply( $func, $params )
You seem to have to do this:
let $params := (‘1’, ‘2’, ‘3’)
return xdmp:apply($func, $params[1], $params[2], $params[3])
(Side note: Some googling turned up this 2011 post discussing the ‘varargs’ aspect of xdmp:apply.)
I’ve actually implemented a fix locally and it seems to work. Of course, it has all ugliness mentioned in the above post. Happy to submit a pull request if, in fact, this is an issue.
If it isn’t an issue, please advise how one uses helper:assert-throws-error with multiple vars.