Skip to content

Commit

Permalink
Merge pull request #675 from xml-project/add-tests
Browse files Browse the repository at this point in the history
Additional tests
  • Loading branch information
xml-project authored Dec 15, 2023
2 parents 2209a10 + 96e6234 commit 2b723d5
Show file tree
Hide file tree
Showing 8 changed files with 436 additions and 0 deletions.
59 changes: 59 additions & 0 deletions test-suite/tests/ab-choose-073.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<t:test expected="pass"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<t:info>
<t:title>AB choose-073</t:title>
<t:revision-history>
<t:revision>
<t:date>2023-12-10</t:date>
<t:author>
<t:name>Achim Berndzen</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Additional tests for p:choose</p>
</t:description>
</t:revision>
</t:revision-history>
</t:info>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Tests p:choose inside p:if with test="false()"</p>
</t:description>
<t:pipeline>
<p:declare-step name="pipeline"
version="3.0"
xmlns:p="http://www.w3.org/ns/xproc">
<p:output port="result"/>
<p:identity>
<p:with-input>
<doc />
</p:with-input>
</p:identity>

<p:if test="false()">
<p:choose>
<p:when test="/doc">
<p:identity>
<p:with-input><correct /></p:with-input>
</p:identity>
</p:when>
<p:otherwise>
<p:identity>
<p:with-input><wrong /></p:with-input>
</p:identity>
</p:otherwise>
</p:choose>
</p:if>
</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="doc">The root element is not 'doc'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
</t:schematron>
</t:test>
58 changes: 58 additions & 0 deletions test-suite/tests/ab-choose-074.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<t:test expected="pass"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<t:info>
<t:title>p:choose-074 (AB)</t:title>
<t:revision-history>
<t:revision>
<t:date>2023-12-10</t:date>
<t:author>
<t:name>Achim Berndzen</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>New tests</p>
</t:description>
</t:revision>
</t:revision-history>
</t:info>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Test p:choose with a p:try child and test="false()" and no p:otherwise.</p>
</t:description>
<t:pipeline>
<p:declare-step version="3.0"
xmlns:p="http://www.w3.org/ns/xproc">
<p:output port="result"/>
<p:identity>
<p:with-input>
<doc/>
</p:with-input>
</p:identity>
<p:choose>
<p:when test="false()">
<p:try>
<p:add-attribute match="/doc"
attribute-name="a"
attribute-value="42"/>
<p:catch>
<p:identity>
<p:with-input><error /></p:with-input>
</p:identity>
</p:catch>
</p:try>
</p:when>
</p:choose>
</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="/doc">Root element is not 'doc'.</s:assert>
<s:assert test="count(/result/@*)=0">Root should not have an attribute.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
</t:schematron>
</t:test>
53 changes: 53 additions & 0 deletions test-suite/tests/ab-choose-075.xml
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"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<t:info>
<t:title>p:choose-075 (AB)</t:title>
<t:revision-history>
<t:revision>
<t:date>2023-12-10</t:date>
<t:author>
<t:name>Achim Berndzen</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>New tests</p>
</t:description>
</t:revision>
</t:revision-history>
</t:info>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Test p:choose with a p:group child and test="false()" and no p:otherwise.</p>
</t:description>
<t:pipeline>
<p:declare-step version="3.0"
xmlns:p="http://www.w3.org/ns/xproc">
<p:output port="result"/>
<p:identity>
<p:with-input>
<doc/>
</p:with-input>
</p:identity>
<p:choose>
<p:when test="false()">
<p:group>
<p:add-attribute match="/doc"
attribute-name="a"
attribute-value="42"/>
</p:group>
</p:when>
</p:choose>
</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="/doc">Root element is not 'doc'.</s:assert>
<s:assert test="count(/result/@*)=0">Root should not have an attribute.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
</t:schematron>
</t:test>
53 changes: 53 additions & 0 deletions test-suite/tests/ab-choose-076.xml
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"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<t:info>
<t:title>p:choose-076 (AB)</t:title>
<t:revision-history>
<t:revision>
<t:date>2023-12-10</t:date>
<t:author>
<t:name>Achim Berndzen</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>New tests</p>
</t:description>
</t:revision>
</t:revision-history>
</t:info>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Test p:choose with a p:for-each child and test="false()" and no p:otherwise.</p>
</t:description>
<t:pipeline>
<p:declare-step version="3.0"
xmlns:p="http://www.w3.org/ns/xproc">
<p:output port="result"/>
<p:identity>
<p:with-input>
<doc/>
</p:with-input>
</p:identity>
<p:choose>
<p:when test="false()">
<p:for-each>
<p:add-attribute match="/doc"
attribute-name="a"
attribute-value="42"/>
</p:for-each>
</p:when>
</p:choose>
</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="/doc">Root element is not 'doc'.</s:assert>
<s:assert test="count(/result/@*)=0">Root should not have an attribute.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
</t:schematron>
</t:test>
55 changes: 55 additions & 0 deletions test-suite/tests/ab-if-034.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<t:test expected="pass"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<t:info>
<t:title>p:if-034 (AB)</t:title>
<t:revision-history>
<t:revision>
<t:date>2023-12-10</t:date>
<t:author>
<t:name>Achim Berndzen</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>New tests</p>
</t:description>
</t:revision>
</t:revision-history>
</t:info>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Test p:if with a sequence as DRP and test="false()".</p>
</t:description>
<t:pipeline>
<p:declare-step version="3.0"
xmlns:p="http://www.w3.org/ns/xproc">
<p:output port="result"/>
<p:identity>
<p:with-input>
<doc/>
<doc/>
</p:with-input>
</p:identity>
<p:if test="false()" name="if">
<p:for-each>
<p:add-attribute match="/doc"
attribute-name="a"
attribute-value="{p:iteration-position()}"/>
</p:for-each>
</p:if>
<p:wrap-sequence wrapper="result"/>
</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">Root element is not 'result'.</s:assert>
<s:assert test="count(/result/*)=2">Root should only have one child.</s:assert>
<s:assert test="/result/*[1]/name()='doc'">First child of 'result' is not 'doc'.</s:assert>
<s:assert test="/result/*[2]/name()='doc'">Second child of 'result' is not 'doc'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
</t:schematron>
</t:test>
56 changes: 56 additions & 0 deletions test-suite/tests/ab-if-035.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<t:test expected="pass"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<t:info>
<t:title>p:if-035 (AB)</t:title>
<t:revision-history>
<t:revision>
<t:date>2023-12-10</t:date>
<t:author>
<t:name>Achim Berndzen</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>New tests</p>
</t:description>
</t:revision>
</t:revision-history>
</t:info>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Test p:if with a p:try child and test="false()".</p>
</t:description>
<t:pipeline>
<p:declare-step version="3.0"
xmlns:p="http://www.w3.org/ns/xproc">
<p:output port="result"/>
<p:identity>
<p:with-input>
<doc/>
</p:with-input>
</p:identity>
<p:if test="false()">
<p:try>
<p:add-attribute match="/doc"
attribute-name="a"
attribute-value="42"/>
<p:catch>
<p:identity>
<p:with-input><error /></p:with-input>
</p:identity>
</p:catch>
</p:try>
</p:if>
</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="/doc">Root element is not 'doc'.</s:assert>
<s:assert test="count(/result/@*)=0">Root should not have an attribute.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
</t:schematron>
</t:test>
51 changes: 51 additions & 0 deletions test-suite/tests/ab-if-036.xml
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"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<t:info>
<t:title>p:if-036 (AB)</t:title>
<t:revision-history>
<t:revision>
<t:date>2023-12-10</t:date>
<t:author>
<t:name>Achim Berndzen</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>New tests</p>
</t:description>
</t:revision>
</t:revision-history>
</t:info>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Test p:if with a p:group child and test="false()".</p>
</t:description>
<t:pipeline>
<p:declare-step version="3.0"
xmlns:p="http://www.w3.org/ns/xproc">
<p:output port="result"/>
<p:identity>
<p:with-input>
<doc/>
</p:with-input>
</p:identity>
<p:if test="false()">
<p:group>
<p:add-attribute match="/doc"
attribute-name="a"
attribute-value="42"/>
</p:group>
</p:if>
</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="/doc">Root element is not 'doc'.</s:assert>
<s:assert test="count(/result/@*)=0">Root should not have an attribute.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
</t:schematron>
</t:test>
Loading

0 comments on commit 2b723d5

Please sign in to comment.