-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adapted import XQuery function tests
- Loading branch information
Showing
19 changed files
with
696 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
xquery version "3.1"; | ||
module namespace test="http://xproc.org/ns/testsuite/3.0/function-test"; | ||
|
||
declare function test:function() as item(){ | ||
element{"function-result"}{} | ||
}; | ||
|
||
declare function test:function1() as item(){ | ||
element{"function-result"}{} | ||
}; | ||
declare function test:function2($par as xs:string) as item(){ | ||
element{"function-result"}{$par} | ||
}; | ||
declare %private function test:private-function() as item(){ | ||
element{"function-result"}{} | ||
}; | ||
declare function test:function3() as item(){ | ||
element{"namespaced-function"}{} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
xquery version "3.1"; | ||
module namespace test="http://xproc.org/ns/testsuite/3.0/function-test" | ||
(:intentionally invalid; missing semicolon:) | ||
declare namespace test1="http://xproc.org/ns/testsuite/3.0/function-test1"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
xquery version "3.1"; | ||
module namespace test="http://xproc.org/ns/testsuite/3.0/function-test"; | ||
|
||
declare function test:function() as item(){ | ||
element{"function-result"}{} | ||
}; | ||
|
||
declare function test:function1() as item(){ | ||
element{"function-result1"}{} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
xquery version "3.1"; | ||
module namespace test="http://xproc.org/ns/testsuite/3.0/function-test"; | ||
|
||
declare function test:function1($par as xs:string) as item(){ | ||
element{"function-result"}{$par} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<t:test expected="pass" features="xquery-function-import" | ||
xmlns:t="http://xproc.org/ns/testsuite/3.0"> | ||
<t:info> | ||
<t:title>nw-import-functions-015</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-12-05</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests for p:import-function; adapted from ab-import-functions-015 but | ||
uses an XQuery library module.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests p:import-functions from an XQuery library module.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step version="3.0" | ||
xmlns:p="http://www.w3.org/ns/xproc" | ||
xmlns:test="http://xproc.org/ns/testsuite/3.0/function-test"> | ||
<p:import-functions href="../documents/xquery-library.xq" content-type="application/xquery" /> | ||
<p:output port="result"/> | ||
<p:identity> | ||
<p:with-input> | ||
<result>{test:function1()}</result> | ||
</p:with-input> | ||
</p:identity> | ||
</p:declare-step> | ||
</t:pipeline> | ||
<t:schematron> | ||
<s:schema queryBinding="xslt2" | ||
xmlns:s="http://purl.oclc.org/dsdl/schematron" | ||
xmlns="http://www.w3.org/1999/xhtml"> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="result">The document root is not result.</s:assert> | ||
<s:assert test="result/function-result">Result does not have a child "function-result".</s:assert> | ||
</s:rule> | ||
</s:pattern> | ||
</s:schema> | ||
</t:schematron> | ||
</t:test> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<t:test expected="pass" features="xquery-function-import" | ||
xmlns:t="http://xproc.org/ns/testsuite/3.0"> | ||
<t:info> | ||
<t:title>nw-import-functions-016</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-12-05</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests for p:import-function; adapted from ab-import-functions-016 but | ||
uses an XQuery library module.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests p:import-functions: function with par</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step version="3.0" | ||
xmlns:p="http://www.w3.org/ns/xproc" | ||
xmlns:test="http://xproc.org/ns/testsuite/3.0/function-test"> | ||
<p:import-functions href="../documents/xquery-library.xq" content-type="application/xquery"/> | ||
<p:output port="result"/> | ||
<p:identity> | ||
<p:with-input> | ||
<result>{test:function2("test")}</result> | ||
</p:with-input> | ||
</p:identity> | ||
</p:declare-step> | ||
</t:pipeline> | ||
<t:schematron> | ||
<s:schema queryBinding="xslt2" | ||
xmlns:s="http://purl.oclc.org/dsdl/schematron" | ||
xmlns="http://www.w3.org/1999/xhtml"> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="result">The document root is not result.</s:assert> | ||
<s:assert test="result/function-result">Result does not have a child "function-result".</s:assert> | ||
<s:assert test="result/function-result/text()='test'">There is not text child 'test' in "function-result".</s:assert> | ||
</s:rule> | ||
</s:pattern> | ||
</s:schema> | ||
</t:schematron> | ||
</t:test> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<t:test expected="pass" features="xquery-function-import" | ||
xmlns:t="http://xproc.org/ns/testsuite/3.0"> | ||
<t:info> | ||
<t:title>nw-import-functions-017</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-12-05</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests for p:import-function; adapted from ab-import-functions-017 but | ||
uses an XQuery library module.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests p:import-functions: Test function is visible in inner steps.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step version="3.0" | ||
xmlns:p="http://www.w3.org/ns/xproc" | ||
xmlns:test="http://xproc.org/ns/testsuite/3.0/function-test"> | ||
<p:import-functions href="../documents/xquery-library.xq" content-type="application/xquery" /> | ||
<p:output port="result" /> | ||
<p:declare-step type="test:step"> | ||
<p:output port="result"/> | ||
<p:identity> | ||
<p:with-input> | ||
<result>{test:function1()}</result> | ||
</p:with-input> | ||
</p:identity> | ||
</p:declare-step> | ||
<test:step /> | ||
</p:declare-step> | ||
</t:pipeline> | ||
<t:schematron> | ||
<s:schema queryBinding="xslt2" | ||
xmlns:s="http://purl.oclc.org/dsdl/schematron" | ||
xmlns="http://www.w3.org/1999/xhtml"> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="result">The document root is not result.</s:assert> | ||
<s:assert test="result/function-result">Result does not have a child "function-result".</s:assert> | ||
</s:rule> | ||
</s:pattern> | ||
</s:schema> | ||
</t:schematron> | ||
</t:test> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<t:test expected="pass" features="xquery-function-import" | ||
xmlns:t="http://xproc.org/ns/testsuite/3.0"> | ||
<t:info> | ||
<t:title>nw-import-functions-018</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-12-05</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests for p:import-function; adapted from ab-import-functions-018 but | ||
uses an XQuery library module.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests p:import-functions: Test function imported globally and locally.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step version="3.0" | ||
xmlns:p="http://www.w3.org/ns/xproc" | ||
xmlns:test="http://xproc.org/ns/testsuite/3.0/function-test"> | ||
<p:import-functions href="../documents/xquery-library.xq" content-type="application/xquery" /> | ||
<p:output port="result" /> | ||
|
||
<p:declare-step type="test:step"> | ||
<p:import-functions href="../documents/xquery-library.xq" content-type="application/xquery" /> | ||
<p:output port="result"/> | ||
<p:identity> | ||
<p:with-input> | ||
<result>{test:function1()}</result> | ||
</p:with-input> | ||
</p:identity> | ||
</p:declare-step> | ||
<test:step /> | ||
</p:declare-step> | ||
</t:pipeline> | ||
<t:schematron> | ||
<s:schema queryBinding="xslt2" | ||
xmlns:s="http://purl.oclc.org/dsdl/schematron" | ||
xmlns="http://www.w3.org/1999/xhtml"> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="result">The document root is not result.</s:assert> | ||
<s:assert test="result/function-result">Result does not have a child "function-result".</s:assert> | ||
</s:rule> | ||
</s:pattern> | ||
</s:schema> | ||
</t:schematron> | ||
</t:test> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<t:test expected="fail" code="err:XS0107" features="xquery-function-import" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
xmlns:t="http://xproc.org/ns/testsuite/3.0"> | ||
<t:info> | ||
<t:title>nw-import-functions-019</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-12-05</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests for p:import-function; adapted from ab-import-functions-019 but | ||
uses an XQuery library module.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests p:import-functions: Test function imported locally imported function is not visible globally.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step version="3.0" | ||
xmlns:p="http://www.w3.org/ns/xproc" | ||
xmlns:test="http://xproc.org/ns/testsuite/3.0/function-test"> | ||
<p:output port="result" /> | ||
|
||
<p:declare-step type="test:step"> | ||
<p:import-functions href="../documents/xquery-library.xq" content-type="application/xquery" /> | ||
<p:output port="result"/> | ||
<p:identity> | ||
<p:with-input> | ||
<result>{test:function1()}</result> | ||
</p:with-input> | ||
</p:identity> | ||
</p:declare-step> | ||
|
||
<p:identity> | ||
<p:with-input> | ||
<result>{test:function1()}</result> | ||
</p:with-input> | ||
</p:identity> | ||
</p:declare-step> | ||
</t:pipeline> | ||
</t:test> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<t:test expected="fail" code="err:XS0107" features="xquery-function-import" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
xmlns:t="http://xproc.org/ns/testsuite/3.0"> | ||
<t:info> | ||
<t:title>nw-import-functions-020</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-12-05</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests for p:import-function; adapted from ab-import-functions-020 but | ||
uses an XQuery library module.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests p:import-functions: Test function imported locally imported function is not visible in other step.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step version="3.0" | ||
xmlns:p="http://www.w3.org/ns/xproc" | ||
xmlns:test="http://xproc.org/ns/testsuite/3.0/function-test"> | ||
<p:output port="result" /> | ||
|
||
<p:declare-step type="test:step"> | ||
<p:import-functions href="../documents/xquery-library.xq" content-type="application/xquery" /> | ||
<p:output port="result"/> | ||
<p:identity> | ||
<p:with-input> | ||
<result>{test:function1()}</result> | ||
</p:with-input> | ||
</p:identity> | ||
</p:declare-step> | ||
|
||
<p:declare-step type="test:step1"> | ||
<p:output port="result" /> | ||
<p:identity> | ||
<p:with-input> | ||
<result>{test:function1()}</result> | ||
</p:with-input> | ||
</p:identity> | ||
</p:declare-step> | ||
|
||
<test:step1 /> | ||
</p:declare-step> | ||
</t:pipeline> | ||
</t:test> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<t:test expected="fail" code="err:XS0107" features="xquery-function-import" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
xmlns:t="http://xproc.org/ns/testsuite/3.0"> | ||
<t:info> | ||
<t:title>nw-import-functions-021</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-12-05</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests for p:import-function; adapted from ab-import-functions-021 but | ||
uses an XQuery library module.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests p:import-functions: Calling non defined function is an error.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step version="3.0" | ||
xmlns:p="http://www.w3.org/ns/xproc" | ||
xmlns:test="http://xproc.org/ns/testsuite/3.0/function-test"> | ||
<p:import-functions href="../documents/xquery-library.xq" content-type="application/xquery" /> | ||
<p:output port="result" /> | ||
|
||
<p:identity> | ||
<p:with-input><result>{test:undefined-function()}</result></p:with-input> | ||
</p:identity> | ||
</p:declare-step> | ||
</t:pipeline> | ||
</t:test> |
Oops, something went wrong.