Closed joewiz closed 1 year ago
While the CI passes on the tests of eXist 5.2.0
, 5.4.1
, and (in my local tests) release
, the failure on latest
is due to the change in error codes in eXist 7.0.0-SNAPSHOT (HEAD), which affects 3 tests here in the templating module.
Here's the patch that enables the tests to pass under 7.0.0-SNAPSHOT:
0001-eXist-7.0.0-SNAPSHOT-compatibility.patch
I do not know how to adjust the tests to be able to detect which matrix environment they're running under and to pass if the error code is 400 under eXist <7 and 500 under eXist >=7.
@joewiz i think you would need to adjust the test function to execute system:get-version make the comparison inside the function and use assertTrue as Xqs annotation. Something along these lines.
@duncdrum Thanks for the pointer! I did a little more research and settled on a solution that hopefully makes sense. I changed the error code check from to.equal(400)
to to.be.oneOf([400, 500])
, because, as I noted in the commit message just now:
eXist 6.2.0 and earlier issues an error 400 when the
fn:error
function is called. With 7.0.0-SNAPSHOT (https://github.com/eXist-db/exist/pull/4649), eXist issues an error 500. The precise error code is outside the scope of this package - it’s an issue decided by the eXist API - so we can accept either here.
All tests now pass.
This works too,
Before this PR, a function that declared a parameter as
xs:boolean
with a templating default value for this parameter was not cast toxs:boolean
.In eXist 7.0.0-SNAPSHOT, this led to an error in the function-documentation app. Specifically, app:module() function declares that
$details
parameter bexs:boolean
, and the templating annotation supplies a default value for this parameter, but when the function passes this default value to the app:print-module function, an error is raised because the function's signature requires this parameter to be of typexs:boolean
. Loading the landing page of the function documentation app raises the error shown below.This PR fixes the
templates:cast
function to ensure that templating defaults are correctly cast to match their function's signature when the signature requires them to bexs:boolean
.The hint that this problem was present was https://github.com/eXist-db/function-documentation/pull/64/files#r1187748791.