xray icon indicating copy to clipboard operation
xray copied to clipboard

Invalid child node exception when comparing JSON arrays or objects.

Open rhdunn opened this issue 3 years ago • 0 comments

Given:

declare %test:case function compare-2-json-array()
{
  let $actual := array-node { 1, 2, 3 }
  let $expected := array-node { 1, 3, 5 }
  return assert:equal($actual, $expected)
};

I get an XDMP-CHILDNODEKIND "Invalid child node kind" error in src/xray.xqy when it is trying to add the array-node to the XML output.

A fix for this -- and making the JSON output work better when the expected/actual values are XML, would be something like:

    element actual { xdmp:quote($actual) },
    element expected { xdmp:quote($expected) },

rhdunn avatar Jun 18 '21 11:06 rhdunn