Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

helper:assert-throws-error, xdmp:apply, varargs #503

@kefo

Description

@kefo

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions