Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/assertions.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ declare function assert:false(
};


declare private function deep-equal(
declare %private function deep-equal(
$a as item()*,
$b as item()*
) as xs:boolean
Expand Down
2 changes: 1 addition & 1 deletion src/modules-database.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ xquery version "1.0-ml";

module namespace modules-db = "http://github.com/robwhitby/xray/modules-db";

declare private variable $eval-options :=
declare %private variable $eval-options :=
<options xmlns="xdmp:eval">
<database>{xdmp:modules-database()}</database>
</options>;
Expand Down
8 changes: 4 additions & 4 deletions src/modules-filesystem.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ declare function get-modules(
};


declare private function module-filenames(
declare %private function module-filenames(
$dir as xs:string
) as xs:string*
{
Expand All @@ -32,14 +32,14 @@ declare private function module-filenames(
};


declare private function filesystem-directory-exists(
declare %private function filesystem-directory-exists(
$dir as xs:string
) as xs:boolean
{
try { fn:exists(xdmp:filesystem-directory($dir)) }
catch($e)
catch *
{
if ($e/error:code = "SVC-DIROPEN")
if ($err:code = "SVC-DIROPEN")
then fn:false()
else xdmp:rethrow()
}
Expand Down
4 changes: 2 additions & 2 deletions src/modules.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ declare namespace test = "http://github.com/robwhitby/xray/test";
import module namespace modules-fs = "http://github.com/robwhitby/xray/modules-fs" at "modules-filesystem.xqy";
import module namespace modules-db = "http://github.com/robwhitby/xray/modules-db" at "modules-database.xqy";

declare private variable $TEST-NS-URI := fn:namespace-uri-for-prefix("test", <test:x/>);
declare private variable $USE-MODULES-DB := (xdmp:modules-database() ne 0);
declare %private variable $TEST-NS-URI := fn:namespace-uri-for-prefix("test", <test:x/>);
declare %private variable $USE-MODULES-DB := (xdmp:modules-database() ne 0);


declare function get-modules(
Expand Down
14 changes: 7 additions & 7 deletions src/xray.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ declare function assert-response(
};


declare private function apply(
declare %private function apply(
$fn as function(*),
$path as xs:string
) as item()*
Expand Down Expand Up @@ -145,17 +145,17 @@ declare function run-module(
(xs:QName("path"), $path, xs:QName("test-pattern"), fn:string($test-pattern))
)
}
catch($ex) {
catch * {
(: https://github.com/spig/xray/commit/3bf0e7facaa5260f19556bf431469d967d00c3c1 :)
switch ($ex/error:code)
switch ($err:code)
case "XDMP-IMPMODNS"
return
if ($ex/error:data/error:datum/fn:contains(., $path)) then
if ($err:additional/error:datum/fn:contains(., $path)) then
() (: ignore - module not in test namespace :)
else $ex (: must be an error in an import of the $path module :)
case "XDMP-IMPORTMOD"
return
if ($ex/error:data/error:datum/fn:contains(., $path)) then
if ($err:additional/error:datum/fn:contains(., $path)) then
() (: ignore - main module if path of current module :)
else $ex (: must be an error in an import of the $path module :)
default return $ex
Expand Down Expand Up @@ -192,15 +192,15 @@ declare function has-test-annotation(
};


declare private function fn-local-name(
declare %private function fn-local-name(
$fn as function(*)
) as xs:string
{
fn:string(fn:local-name-from-QName(xdmp:function-name($fn)))
};


declare private function transform(
declare %private function transform(
$el as element(),
$test-dir as xs:string,
$module-pattern as xs:string?,
Expand Down
6 changes: 3 additions & 3 deletions test/error-handling.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ module namespace test = "http://github.com/robwhitby/xray/test";
import module namespace assert = "http://github.com/robwhitby/xray/assertions" at "/xray/src/assertions.xqy";


declare private function something-that-errors() {
declare %private function something-that-errors() {
fn:error((), "MY-ERROR", "something went wrong")
};

declare %test:case function should-be-able-to-assert-error-code()
{
let $actual := try { something-that-errors() } catch ($ex) { $ex }
let $actual := try { something-that-errors() } catch * { $err:description }
return (
assert:error($actual, "MY-ERROR"),
assert:equal($actual/error:data/fn:string(), "something went wrong")
assert:equal($actual, "something went wrong")
)
};

Expand Down
2 changes: 1 addition & 1 deletion test/setup-teardown-multiple.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import module namespace assert = "http://github.com/robwhitby/xray/assertions" a
add any test docs used by the tests in this module
:)

declare private variable $test-docs :=
declare %private variable $test-docs :=
<docs>
<doc uri="one.xml">
<root><test>one</test></root>
Expand Down
2 changes: 1 addition & 1 deletion test/setup-teardown.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import module namespace assert = "http://github.com/robwhitby/xray/assertions" a
add any test docs used by the tests in this module
:)

declare private variable $test-docs :=
declare %private variable $test-docs :=
<docs>
<doc uri="one.xml">
<root><test>one</test></root>
Expand Down
2 changes: 1 addition & 1 deletion test/tests.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ declare %test:case function should-be-able-to-test-empty-xpath()
return assert:empty($xml/p[3])
};

declare private function get-xml()
declare %private function get-xml()
{
<test><p>para 1</p><p>para 2</p></test>
};
Expand Down