Skip to content

Commit

Permalink
Merge pull request #719 from xml-project/test-validate-dtd
Browse files Browse the repository at this point in the history
Some tests for p:validate-with-dtd
  • Loading branch information
xml-project authored Aug 15, 2024
2 parents aef1d54 + 6c317e6 commit 3b98a60
Show file tree
Hide file tree
Showing 14 changed files with 741 additions and 0 deletions.
55 changes: 55 additions & 0 deletions test-suite/tests/ab-validate-with-dtd-001.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"
features="p-validate-with-dtd"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<t:info>
<t:title>ab-validate-with-dtd-001</t:title>
<t:revision-history>
<t:revision>
<t:date>2024-08-14</t:date>
<t:author>
<t:name>Achim Berndzen</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Initial check in.</p>
</t:description>
</t:revision>
</t:revision-history>
</t:info>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Test DTD validation: doctype-system in step's serialization map.</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:validate-with-dtd serialization="map{'doctype-system' : '../documents/address.dtd'}">
<p:with-input>
<address >
<first>Douglas</first>
<last>Adams</last>
<phone>42</phone>
</address>
</p:with-input>
</p:validate-with-dtd>
</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="address">The document is not 'address'.</s:assert>
<s:assert test="address/first">There is no child element 'first'.</s:assert>
<s:assert test="address/first/text() = 'Douglas'">There is no text child in first with 'Douglas'.</s:assert>
<s:assert test="address/last">There is no child element 'last'.</s:assert>
<s:assert test="address/last/text() = 'Adams'">There is no text child in last with 'Adam'.</s:assert>
<s:assert test="address/phone">There is no child element 'phone'.</s:assert>
<s:assert test="address/phone/text() = '42'">There is no text child in phone with '42'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
</t:schematron>
</t:test>
59 changes: 59 additions & 0 deletions test-suite/tests/ab-validate-with-dtd-002.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"
features="p-validate-with-dtd"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<t:info>
<t:title>ab-validate-with-dtd-002</t:title>
<t:revision-history>
<t:revision>
<t:date>2024-08-14</t:date>
<t:author>
<t:name>Achim Berndzen</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Initial check in.</p>
</t:description>
</t:revision>
</t:revision-history>
</t:info>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Test DTD validation: doctype-system in document's serialization map.</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:validate-with-dtd>
<p:with-input>
<p:inline document-properties="map{'serialization' :
map{'doctype-system' : '../documents/address.dtd'}
}">
<address >
<first>Douglas</first>
<last>Adams</last>
<phone>42</phone>
</address>
</p:inline>
</p:with-input>
</p:validate-with-dtd>
</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="address">The document is not 'address'.</s:assert>
<s:assert test="address/first">There is no child element 'first'.</s:assert>
<s:assert test="address/first/text() = 'Douglas'">There is no text child in first with 'Douglas'.</s:assert>
<s:assert test="address/last">There is no child element 'last'.</s:assert>
<s:assert test="address/last/text() = 'Adams'">There is no text child in last with 'Adam'.</s:assert>
<s:assert test="address/phone">There is no child element 'phone'.</s:assert>
<s:assert test="address/phone/text() = '42'">There is no text child in phone with '42'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
</t:schematron>
</t:test>
59 changes: 59 additions & 0 deletions test-suite/tests/ab-validate-with-dtd-003.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"
features="p-validate-with-dtd"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<t:info>
<t:title>ab-validate-with-dtd-003</t:title>
<t:revision-history>
<t:revision>
<t:date>2024-08-14</t:date>
<t:author>
<t:name>Achim Berndzen</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Initial check in.</p>
</t:description>
</t:revision>
</t:revision-history>
</t:info>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Test DTD validation: doctype-system in document's and step's serialization map: step's map should win.</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:validate-with-dtd serialization="map{'doctype-system' : 'i-do-not-exist'}">
<p:with-input>
<p:inline document-properties="map{'serialization' :
map{'doctype-system' : '../documents/address.dtd'}
}">
<address >
<first>Douglas</first>
<last>Adams</last>
<phone>42</phone>
</address>
</p:inline>
</p:with-input>
</p:validate-with-dtd>
</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="address">The document is not 'address'.</s:assert>
<s:assert test="address/first">There is no child element 'first'.</s:assert>
<s:assert test="address/first/text() = 'Douglas'">There is no text child in first with 'Douglas'.</s:assert>
<s:assert test="address/last">There is no child element 'last'.</s:assert>
<s:assert test="address/last/text() = 'Adams'">There is no text child in last with 'Adam'.</s:assert>
<s:assert test="address/phone">There is no child element 'phone'.</s:assert>
<s:assert test="address/phone/text() = '42'">There is no text child in phone with '42'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
</t:schematron>
</t:test>
56 changes: 56 additions & 0 deletions test-suite/tests/ab-validate-with-dtd-004.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"
features="p-validate-with-dtd"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<t:info>
<t:title>ab-validate-with-dtd-004</t:title>
<t:revision-history>
<t:revision>
<t:date>2024-08-15</t:date>
<t:author>
<t:name>Achim Berndzen</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Initial check in.</p>
</t:description>
</t:revision>
</t:revision-history>
</t:info>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Test DTD validation: doctype-system in step's serialization map. Document is valid,
so there should be no detection in xvrl.</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:validate-with-dtd serialization="map{'doctype-system' : '../documents/address.dtd'}">
<p:with-input>
<address >
<first>Douglas</first>
<last>Adams</last>
<phone>42</phone>
</address>
</p:with-input>
</p:validate-with-dtd>
<p:identity>
<p:with-input pipe="report" />
</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:ns uri="http://www.xproc.org/ns/xvrl"
prefix="xvrl"/>
<s:pattern>
<s:rule context="/">
<s:assert test="//xvrl:report">There is no xvrl:report element.</s:assert>
<s:assert test="not(exists(//xvrl:report//xvrl:detection))">There should be no element 'xvrl:detection'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
</t:schematron>
</t:test>
60 changes: 60 additions & 0 deletions test-suite/tests/ab-validate-with-dtd-005.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<t:test expected="pass"
features="p-validate-with-dtd"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<t:info>
<t:title>ab-validate-with-dtd-005</t:title>
<t:revision-history>
<t:revision>
<t:date>2024-08-15</t:date>
<t:author>
<t:name>Achim Berndzen</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Initial check in.</p>
</t:description>
</t:revision>
</t:revision-history>
</t:info>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Test DTD validation: doctype-system in document's serialization map. Document is valid,
so there should be no detection in xvrl.</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:validate-with-dtd>
<p:with-input>
<p:inline document-properties="map{'serialization' :
map{'doctype-system' : '../documents/address.dtd'}
}">
<address >
<first>Douglas</first>
<last>Adams</last>
<phone>42</phone>
</address>
</p:inline>
</p:with-input>
</p:validate-with-dtd>
<p:identity>
<p:with-input pipe="report" />
</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:ns uri="http://www.xproc.org/ns/xvrl"
prefix="xvrl"/>
<s:pattern>
<s:rule context="/">
<s:assert test="//xvrl:report">There is no xvrl:report element.</s:assert>
<s:assert test="not(exists(//xvrl:report//xvrl:detection))">There should be no element 'xvrl:detection'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
</t:schematron>
</t:test>
60 changes: 60 additions & 0 deletions test-suite/tests/ab-validate-with-dtd-006.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<t:test expected="pass"
features="p-validate-with-dtd"
xmlns:t="http://xproc.org/ns/testsuite/3.0">
<t:info>
<t:title>ab-validate-with-dtd-006</t:title>
<t:revision-history>
<t:revision>
<t:date>2024-08-15</t:date>
<t:author>
<t:name>Achim Berndzen</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Initial check in.</p>
</t:description>
</t:revision>
</t:revision-history>
</t:info>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Test DTD validation: doctype-system in document's and step's serialization map: step's map should win.
Document is valid, so there should be no detection in xvrl.</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:validate-with-dtd serialization="map{'doctype-system' : 'i-do-not-exist'}">
<p:with-input>
<p:inline document-properties="map{'serialization' :
map{'doctype-system' : '../documents/address.dtd'}
}">
<address >
<first>Douglas</first>
<last>Adams</last>
<phone>42</phone>
</address>
</p:inline>
</p:with-input>
</p:validate-with-dtd>
<p:identity>
<p:with-input pipe="report" />
</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:ns uri="http://www.xproc.org/ns/xvrl"
prefix="xvrl"/>
<s:pattern>
<s:rule context="/">
<s:assert test="//xvrl:report">There is no xvrl:report element.</s:assert>
<s:assert test="not(exists(//xvrl:report//xvrl:detection))">There should be no element 'xvrl:detection'.</s:assert>
</s:rule>
</s:pattern>
</s:schema>
</t:schematron>
</t:test>
Loading

0 comments on commit 3b98a60

Please sign in to comment.