-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #820 from xml-project/add-tests
Additional tests for c:data decoding
- Loading branch information
Showing
8 changed files
with
333 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,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<t:test expected="pass" | ||
xmlns:t="http://xproc.org/ns/testsuite/3.0"> | ||
<t:info> | ||
<t:title>cast-content-type 029 (AB)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2025-02-02</t:date> | ||
<t:author> | ||
<t:name>Achim Berndzen</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Test casting from c:data to Text.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests that a c:data document is decoded if cast to Text. Charset UTF-8</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:cast-content-type content-type="text/plain"> | ||
<p:with-input> | ||
<c:data content-type="text/plain" | ||
encoding="base64" | ||
charset="UTF-8" | ||
xmlns:c="http://www.w3.org/ns/xproc-step">Q29weSDCqQ==</c:data> | ||
</p:with-input> | ||
</p:cast-content-type> | ||
<p:wrap-sequence wrapper="result" /> | ||
</p:declare-step> | ||
</t:pipeline> | ||
<t:schematron> | ||
<s:schema queryBinding="xslt2" | ||
xmlns:s="http://purl.oclc.org/dsdl/schematron"> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="result">The root element is not 'result'.</s:assert> | ||
<s:assert test="result/text()='Copy ©'">The text is not correctly decoded.</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,47 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<t:test expected="pass" | ||
xmlns:t="http://xproc.org/ns/testsuite/3.0"> | ||
<t:info> | ||
<t:title>cast-content-type 030 (AB)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2025-02-02</t:date> | ||
<t:author> | ||
<t:name>Achim Berndzen</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Test casting from c:data to Text.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests that a c:data document is decoded if cast to Text. Implicit charset</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:cast-content-type content-type="text/plain"> | ||
<p:with-input> | ||
<c:data content-type="text/plain" | ||
encoding="base64" | ||
xmlns:c="http://www.w3.org/ns/xproc-step">Q29weSDCqQ==</c:data> | ||
</p:with-input> | ||
</p:cast-content-type> | ||
<p:wrap-sequence wrapper="result" /> | ||
</p:declare-step> | ||
</t:pipeline> | ||
<t:schematron> | ||
<s:schema queryBinding="xslt2" | ||
xmlns:s="http://purl.oclc.org/dsdl/schematron"> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="result">The root element is not 'result'.</s:assert> | ||
<s:assert test="result/text()='Copy ©'">The text is not correctly decoded.</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" | ||
xmlns:t="http://xproc.org/ns/testsuite/3.0"> | ||
<t:info> | ||
<t:title>cast-content-type 031 (AB)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2025-02-02</t:date> | ||
<t:author> | ||
<t:name>Achim Berndzen</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Test casting from c:data to Text.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests that a c:data document is decoded if cast to Text. ISO charset</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:cast-content-type content-type="text/plain"> | ||
<p:with-input> | ||
<c:data content-type="text/plain" | ||
encoding="base64" | ||
charset="ISO-8859-1" | ||
xmlns:c="http://www.w3.org/ns/xproc-step">Q29weSCp</c:data> | ||
</p:with-input> | ||
</p:cast-content-type> | ||
<p:wrap-sequence wrapper="result" /> | ||
</p:declare-step> | ||
</t:pipeline> | ||
<t:schematron> | ||
<s:schema queryBinding="xslt2" | ||
xmlns:s="http://purl.oclc.org/dsdl/schematron"> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="result">The root element is not 'result'.</s:assert> | ||
<s:assert test="result/text()='Copy ©'">The text is not correctly decoded.</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="pass" | ||
xmlns:t="http://xproc.org/ns/testsuite/3.0"> | ||
<t:info> | ||
<t:title>cast-content-type 032 (AB)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2025-02-02</t:date> | ||
<t:author> | ||
<t:name>Achim Berndzen</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Test casting from c:data to Text.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests that a c:data document is decoded if cast to Text, default encoding.</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:cast-content-type content-type="text/plain"> | ||
<p:with-input> | ||
<c:data content-type="text/plain" | ||
xmlns:c="http://www.w3.org/ns/xproc-step">Q29weSDCqQ==</c:data> | ||
</p:with-input> | ||
</p:cast-content-type> | ||
<p:wrap-sequence wrapper="result" /> | ||
</p:declare-step> | ||
</t:pipeline> | ||
<t:schematron> | ||
<s:schema queryBinding="xslt2" | ||
xmlns:s="http://purl.oclc.org/dsdl/schematron"> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="result">The root element is not 'result'.</s:assert> | ||
<s:assert test="result/text()='Copy ©'">The text is not correctly decoded.</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,36 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<t:test expected="fail" code="err:XC0074" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
xmlns:t="http://xproc.org/ns/testsuite/3.0"> | ||
<t:info> | ||
<t:title>cast-content-type 033 (AB)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2025-02-02</t:date> | ||
<t:author> | ||
<t:name>Achim Berndzen</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Test casting from c:data to Text.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests that a c:data document decoding raises error, if content-types are not equal.</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:cast-content-type content-type="application/xml"> | ||
<p:with-input> | ||
<c:data content-type="text/plain" | ||
xmlns:c="http://www.w3.org/ns/xproc-step">Q29weSDCqQ==</c:data> | ||
</p:with-input> | ||
</p:cast-content-type> | ||
<p:wrap-sequence wrapper="result" /> | ||
</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,36 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<t:test expected="fail" code="err:XC0052" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
xmlns:t="http://xproc.org/ns/testsuite/3.0"> | ||
<t:info> | ||
<t:title>cast-content-type 034 (AB)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2025-02-02</t:date> | ||
<t:author> | ||
<t:name>Achim Berndzen</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Test casting from c:data to Text.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests that a c:data document decoding raises error, if encoding is unsupported.</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:cast-content-type content-type="text/plain"> | ||
<p:with-input> | ||
<c:data content-type="text/plain" encoding="not-supported" | ||
xmlns:c="http://www.w3.org/ns/xproc-step">Q29weSDCqQ==</c:data> | ||
</p:with-input> | ||
</p:cast-content-type> | ||
<p:wrap-sequence wrapper="result" /> | ||
</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,36 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<t:test expected="fail" code="err:XC0071" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
xmlns:t="http://xproc.org/ns/testsuite/3.0"> | ||
<t:info> | ||
<t:title>cast-content-type 035 (AB)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2025-02-02</t:date> | ||
<t:author> | ||
<t:name>Achim Berndzen</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Test casting from c:data to Text.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests that a c:data document decoding raises error, if charset is unsupported.</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:cast-content-type content-type="text/plain"> | ||
<p:with-input> | ||
<c:data content-type="text/plain" charset="not-supported" | ||
xmlns:c="http://www.w3.org/ns/xproc-step">Q29weSDCqQ==</c:data> | ||
</p:with-input> | ||
</p:cast-content-type> | ||
<p:wrap-sequence wrapper="result" /> | ||
</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,36 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<t:test expected="fail" code="err:XC0073" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
xmlns:t="http://xproc.org/ns/testsuite/3.0"> | ||
<t:info> | ||
<t:title>cast-content-type 036 (AB)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2025-02-02</t:date> | ||
<t:author> | ||
<t:name>Achim Berndzen</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Test casting from c:data to Text.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests that a c:data document decoding raises error, no content-type on c:data.</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:cast-content-type content-type="text/plain"> | ||
<p:with-input> | ||
<c:data | ||
xmlns:c="http://www.w3.org/ns/xproc-step">Q29weSDCqQ==</c:data> | ||
</p:with-input> | ||
</p:cast-content-type> | ||
<p:wrap-sequence wrapper="result" /> | ||
</p:declare-step> | ||
</t:pipeline> | ||
</t:test> |