Skip to content

Commit

Permalink
Merge pull request #689 from ndw/unarchive-fixes
Browse files Browse the repository at this point in the history
Unarchive fixes
  • Loading branch information
xml-project authored May 3, 2024
2 parents 046007b + 9975668 commit 457676e
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 9 deletions.
15 changes: 12 additions & 3 deletions test-suite/tests/ab-unarchive-001.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
<t:info>
<t:title>p:unarchive 001 (AB)</t:title>
<t:revision-history>
<t:revision>
<t:date>2024-05-01</t:date>
<t:author>
<t:name>Norm Tovey-Walsh</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Fixed typos in the Schematron assertion messages.</p>
</t:description>
</t:revision>
<t:revision>
<t:date>2021-06-10</t:date>
<t:author>
Expand Down Expand Up @@ -67,9 +76,9 @@
<s:pattern>
<s:rule context="/">
<s:assert test="result">Root element is not 'result'.</s:assert>
<s:assert test="count(result/entry)=10">Element 'c:archive' does not have 10 children named 'entry'</s:assert>
<s:assert test="count(result/entry)=10">Element 'result' does not have 10 children named 'entry'</s:assert>
<s:assert test="result/entry[ends-with(@base-uri, 'documents/archive.zip/doc.xml')]/@content-type='application/xml'">There is no entry for 'doc.xml' with 'application/xml'.</s:assert>
<s:assert test="result/entry[ends-with(@base-uri, 'documents/archive.zip/text.txt')]/@content-type='text/plain'">Content-type of 'text.text' is not 'text/plain'.</s:assert>
<s:assert test="result/entry[ends-with(@base-uri, 'documents/archive.zip/text.txt')]/@content-type='text/plain'">Content-type of 'text.txt' is not 'text/plain'.</s:assert>
<s:assert test="result/entry[ends-with(@base-uri, 'documents/archive.zip/json.json')]/@content-type='application/json'">Content-type of 'json.json' is not 'application/json'.</s:assert>
<s:assert test="result/entry[ends-with(@base-uri, 'documents/archive.zip/html.html')]/@content-type='text/html'">Content-type of 'html.html' is not 'text/html'.</s:assert>
<s:assert test="result/entry[ends-with(@base-uri, 'documents/archive.zip/fish.jpg')]/@content-type='image/jpeg' or result/entry[ends-with(@base-uri, 'documents/archive.zip/fish.jpg')]/@content-type='application/octet-stream'">Content-type of 'fish.jpg' is not 'image/jpg' or 'application/octet-stream'.</s:assert>
Expand All @@ -82,4 +91,4 @@
</s:pattern>
</s:schema>
</t:schematron>
</t:test>
</t:test>
13 changes: 11 additions & 2 deletions test-suite/tests/ab-unarchive-006.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
xmlns:err="http://www.w3.org/ns/xproc-error"
expected="fail" code="err:XC0085">
expected="fail" code="err:XC0081">
<t:info>
<t:title>p:unarchive 006 (AB)</t:title>
<t:revision-history>
<t:revision>
<t:date>2024-05-01</t:date>
<t:author>
<t:name>Norm Tovey-Walsh</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Change the error code to match the description.</p>
</t:description>
</t:revision>
<t:revision>
<t:date>2019-12-14</t:date>
<t:author>
Expand Down Expand Up @@ -37,4 +46,4 @@
</p:unarchive>
</p:declare-step>
</t:pipeline>
</t:test>
</t:test>
15 changes: 12 additions & 3 deletions test-suite/tests/ab-unarchive-007.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
xmlns:err="http://www.w3.org/ns/xproc-error"
expected="fail" code="err:XC0085">
expected="fail" code="err:XC0081 err:XC0085">
<t:info>
<t:title>p:unarchive 007 (AB)</t:title>
<t:revision-history>
<t:revision>
<t:date>2024-05-01</t:date>
<t:author>
<t:name>Norm Tovey-Walsh</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Allow err:XC0081 as a passing result.</p>
</t:description>
</t:revision>
<t:revision>
<t:date>2019-12-20</t:date>
<t:author>
Expand All @@ -25,7 +34,7 @@
</t:revision-history>
</t:info>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Tests p:unarchive: Test XC0085 is raised, if source is not a zip.</p>
<p>Tests p:unarchive: Test XC0081 or XC0085 is raised, if source is not a zip.</p>
</t:description>

<t:pipeline>
Expand All @@ -37,4 +46,4 @@
</p:unarchive>
</p:declare-step>
</t:pipeline>
</t:test>
</t:test>
12 changes: 11 additions & 1 deletion test-suite/tests/ab-unarchive-019.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
<t:info>
<t:title>p:unarchive 019 (AB)</t:title>
<t:revision-history>
<t:revision>
<t:date>2024-05-01</t:date>
<t:author>
<t:name>Norm Tovey-Walsh</t:name>
</t:author>
<t:description xmlns="http://www.w3.org/1999/xhtml">
<p>Specify merge=false on the call to set-properties so that the base URI
is removed.</p>
</t:description>
</t:revision>
<t:revision>
<t:date>2019-12-21</t:date>
<t:author>
Expand All @@ -31,7 +41,7 @@
</p:with-input>
</p:archive>

<p:set-properties properties="map{}" /> <!-- remove base URI -->
<p:set-properties properties="map{}" merge="false"/> <!-- remove base URI -->

<p:unarchive/>
</p:declare-step>
Expand Down

0 comments on commit 457676e

Please sign in to comment.