Skip to content

Instantly share code, notes, and snippets.

@joewiz
Last active June 24, 2022 21:08
Show Gist options
  • Save joewiz/78b1827971a3c1c5dec8fc2d13dec8b2 to your computer and use it in GitHub Desktop.
Save joewiz/78b1827971a3c1c5dec8fc2d13dec8b2 to your computer and use it in GitHub Desktop.
A report showing function signature mismatches in eXist's implementation of the XPath & XQuery functions & operators spec
xquery version "3.1";
element signature-mismatches {
let $testcases := doc("/db/results.xml")//testcase
for $case in $testcases[failure]
let $expected := parse-xml($case/failure)/signature/*
let $actual := $case/output/signature/*
let $analysis :=
for-each-pair(
$expected,
$actual,
function($e, $a) {
if (deep-equal($e, $a)) then
$e
else
element { name($e) } {
element expected { $e/string() },
element actual { $a/string() }
}
}
)
return
element testcase { $case/@name, $analysis }
}
<?xml version="1.0" encoding="UTF-8"?>
<signature-mismatches>
<testcase name="array_filter_2">
<name>array:filter#2</name>
<arg>array(*)</arg>
<arg>
<expected>function(item()*) as xs:boolean</expected>
<actual>function(*)</actual>
</arg>
<return>array(*)</return>
</testcase>
<testcase name="array_fold-left_3">
<name>array:fold-left#3</name>
<arg>array(*)</arg>
<arg>item()*</arg>
<arg>
<expected>function(item()*, item()*) as item()*</expected>
<actual>function(*)</actual>
</arg>
<return>item()*</return>
</testcase>
<testcase name="array_fold-right_3">
<name>array:fold-right#3</name>
<arg>array(*)</arg>
<arg>item()*</arg>
<arg>
<expected>function(item()*, item()*) as item()*</expected>
<actual>function(*)</actual>
</arg>
<return>item()*</return>
</testcase>
<testcase name="array_for-each-pair_3">
<name>array:for-each-pair#3</name>
<arg>array(*)</arg>
<arg>array(*)</arg>
<arg>
<expected>function(item()*, item()*) as item()*</expected>
<actual>function(*)</actual>
</arg>
<return>array(*)</return>
</testcase>
<testcase name="array_for-each_2">
<name>array:for-each#2</name>
<arg>array(*)</arg>
<arg>
<expected>function(item()*) as item()*</expected>
<actual>function(*)</actual>
</arg>
<return>array(*)</return>
</testcase>
<testcase name="array_sort_3">
<name>array:sort#3</name>
<arg>array(*)</arg>
<arg>xs:string?</arg>
<arg>
<expected>function(item()*) as xs:anyAtomicType*</expected>
<actual>function(*)</actual>
</arg>
<return>array(*)</return>
</testcase>
<testcase name="fn_analyze-string_2">
<name>analyze-string#2</name>
<arg>xs:string?</arg>
<arg>xs:string</arg>
<return>
<expected>element(fn:analyze-string-result)</expected>
<actual>element()</actual>
</return>
</testcase>
<testcase name="fn_analyze-string_3">
<name>analyze-string#3</name>
<arg>xs:string?</arg>
<arg>xs:string</arg>
<arg>xs:string</arg>
<return>
<expected>element(fn:analyze-string-result)</expected>
<actual>element()</actual>
</return>
</testcase>
<testcase name="fn_collection_1">
<name>collection#1</name>
<arg>
<expected>xs:string?</expected>
<actual>xs:string*</actual>
</arg>
<return>item()*</return>
</testcase>
<testcase name="fn_contains-token_3">
<name>contains-token#3</name>
<arg>xs:string*</arg>
<arg>xs:string</arg>
<arg>
<expected>xs:string</expected>
<actual>xs:string?</actual>
</arg>
<return>xs:boolean</return>
</testcase>
<testcase name="fn_current-dateTime_0">
<name>current-dateTime#0</name>
<return>
<expected>xs:dateTimeStamp</expected>
<actual>xs:dateTime</actual>
</return>
</testcase>
<testcase name="fn_document-uri_1">
<name>document-uri#1</name>
<arg>
<expected>node()?</expected>
<actual>node()*</actual>
</arg>
<return>xs:anyURI?</return>
</testcase>
<testcase name="fn_error_0">
<name>error#0</name>
<return>
<expected>none</expected>
<actual>empty-sequence()empty-sequence()</actual>
</return>
</testcase>
<testcase name="fn_error_1">
<name>error#1</name>
<arg>xs:QName?</arg>
<return>
<expected>none</expected>
<actual>empty-sequence()empty-sequence()</actual>
</return>
</testcase>
<testcase name="fn_error_2">
<name>error#2</name>
<arg>xs:QName?</arg>
<arg>xs:string</arg>
<return>
<expected>none</expected>
<actual>empty-sequence()empty-sequence()</actual>
</return>
</testcase>
<testcase name="fn_error_3">
<name>error#3</name>
<arg>xs:QName?</arg>
<arg>xs:string</arg>
<arg>item()*</arg>
<return>
<expected>none</expected>
<actual>empty-sequence()empty-sequence()</actual>
</return>
</testcase>
<testcase name="fn_filter_2">
<name>filter#2</name>
<arg>item()*</arg>
<arg>
<expected>function(item()) as xs:boolean</expected>
<actual>function(*)</actual>
</arg>
<return>item()*</return>
</testcase>
<testcase name="fn_fold-left_3">
<name>fold-left#3</name>
<arg>item()*</arg>
<arg>item()*</arg>
<arg>
<expected>function(item()*, item()) as item()*</expected>
<actual>function(*)</actual>
</arg>
<return>item()*</return>
</testcase>
<testcase name="fn_fold-right_3">
<name>fold-right#3</name>
<arg>item()*</arg>
<arg>item()*</arg>
<arg>
<expected>function(item(), item()*) as item()*</expected>
<actual>function(*)</actual>
</arg>
<return>item()*</return>
</testcase>
<testcase name="fn_for-each-pair_3">
<name>for-each-pair#3</name>
<arg>item()*</arg>
<arg>item()*</arg>
<arg>
<expected>function(item(), item()) as item()*</expected>
<actual>function(*)</actual>
</arg>
<return>item()*</return>
</testcase>
<testcase name="fn_for-each_2">
<name>for-each#2</name>
<arg>item()*</arg>
<arg>
<expected>function(item()) as item()*</expected>
<actual>function(*)</actual>
</arg>
<return>item()*</return>
</testcase>
<testcase name="fn_format-integer_2">
<name>format-integer#2</name>
<arg>
<expected>xs:integer?</expected>
<actual>xs:numeric?</actual>
</arg>
<arg>xs:string</arg>
<return>xs:string</return>
</testcase>
<testcase name="fn_format-integer_3">
<name>format-integer#3</name>
<arg>
<expected>xs:integer?</expected>
<actual>xs:numeric?</actual>
</arg>
<arg>xs:string</arg>
<arg>xs:string?</arg>
<return>xs:string</return>
</testcase>
<testcase name="fn_json-to-xml_1">
<name>json-to-xml#1</name>
<arg>xs:string?</arg>
<return>
<expected>document-node()?</expected>
<actual>item()?</actual>
</return>
</testcase>
<testcase name="fn_json-to-xml_2">
<name>json-to-xml#2</name>
<arg>xs:string?</arg>
<arg>map(*)</arg>
<return>
<expected>document-node()?</expected>
<actual>item()?</actual>
</return>
</testcase>
<testcase name="fn_parse-xml_1">
<name>parse-xml#1</name>
<arg>xs:string?</arg>
<return>
<expected>document-node(element(*))?</expected>
<actual>document-node()?</actual>
</return>
</testcase>
<testcase name="fn_random-number-generator_0">
<name>random-number-generator#0</name>
<return>
<expected>map(xs:string, item())</expected>
<actual>map(*)</actual>
</return>
</testcase>
<testcase name="fn_random-number-generator_1">
<name>random-number-generator#1</name>
<arg>xs:anyAtomicType?</arg>
<return>
<expected>map(xs:string, item())</expected>
<actual>map(*)</actual>
</return>
</testcase>
<testcase name="fn_sort_3">
<name>sort#3</name>
<arg>item()*</arg>
<arg>xs:string?</arg>
<arg>
<expected>function(item()) as xs:anyAtomicType*</expected>
<actual>function(*)</actual>
</arg>
<return>item()*</return>
</testcase>
<testcase name="fn_xml-to-json_2">
<name>xml-to-json#2</name>
<arg>node()?</arg>
<arg>
<expected>map(*)</expected>
<actual>map(*)?</actual>
</arg>
<return>xs:string?</return>
</testcase>
<testcase name="map_for-each_2">
<name>map:for-each#2</name>
<arg>map(*)</arg>
<arg>
<expected>function(xs:anyAtomicType, item()*) as item()*</expected>
<actual>function(*)</actual>
</arg>
<return>item()*</return>
</testcase>
</signature-mismatches>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment