-
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.
Merge pull request #683 from ndw/p-compare-tests
Add tests for p:compare
- Loading branch information
Showing
6 changed files
with
355 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,66 @@ | ||
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
expected="pass"> | ||
<t:info> | ||
<t:title>p:compare 001 (NW)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-03-26</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Created test for p:compare.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Check if p:compare succeeds when the documents are identical.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" | ||
xmlns:test="http://test" version="3.0"> | ||
<p:output port="result"> | ||
<p:pipe step="compare" port="result"/> | ||
</p:output> | ||
|
||
<p:identity name="doc-a"> | ||
<p:with-input> | ||
<doc> | ||
<element name="first"/> | ||
<element/> | ||
</doc> | ||
</p:with-input> | ||
</p:identity> | ||
|
||
<p:identity name="doc-b"> | ||
<p:with-input> | ||
<doc> | ||
<element name="first"/> | ||
<element/> | ||
</doc> | ||
</p:with-input> | ||
</p:identity> | ||
|
||
<p:compare name="compare"> | ||
<p:with-input port="source" pipe="@doc-a"/> | ||
<p:with-input port="alternate" pipe="@doc-b"/> | ||
</p:compare> | ||
|
||
</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 prefix="c" uri="http://www.w3.org/ns/xproc-step"/> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="c:result">Root element is not 'c:result'.</s:assert> | ||
<s:assert test="string(c:result)='true'">Result is not ‘true’.</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,66 @@ | ||
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
expected="pass"> | ||
<t:info> | ||
<t:title>p:compare 002 (NW)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-03-26</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Created test for p:compare.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Check if p:compare fails when the documents are different.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" | ||
xmlns:test="http://test" version="3.0"> | ||
<p:output port="result"> | ||
<p:pipe step="compare" port="result"/> | ||
</p:output> | ||
|
||
<p:identity name="doc-a"> | ||
<p:with-input> | ||
<doc> | ||
<element name="first"/> | ||
<element/> | ||
</doc> | ||
</p:with-input> | ||
</p:identity> | ||
|
||
<p:identity name="doc-b"> | ||
<p:with-input> | ||
<doc> | ||
<element name="second"/> | ||
<element/> | ||
</doc> | ||
</p:with-input> | ||
</p:identity> | ||
|
||
<p:compare name="compare"> | ||
<p:with-input port="source" pipe="@doc-a"/> | ||
<p:with-input port="alternate" pipe="@doc-b"/> | ||
</p:compare> | ||
|
||
</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 prefix="c" uri="http://www.w3.org/ns/xproc-step"/> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="c:result">Root element is not 'c:result'.</s:assert> | ||
<s:assert test="string(c:result)='false'">Result is not ‘false’.</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,66 @@ | ||
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
expected="pass"> | ||
<t:info> | ||
<t:title>p:compare 003 (NW)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-03-26</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Created test for p:compare.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Check if p:compare succeeds when the documents are identical if fail-if-not-equal is true.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" | ||
xmlns:test="http://test" version="3.0"> | ||
<p:output port="result"> | ||
<p:pipe step="compare" port="result"/> | ||
</p:output> | ||
|
||
<p:identity name="doc-a"> | ||
<p:with-input> | ||
<doc> | ||
<element name="first"/> | ||
<element/> | ||
</doc> | ||
</p:with-input> | ||
</p:identity> | ||
|
||
<p:identity name="doc-b"> | ||
<p:with-input> | ||
<doc> | ||
<element name="first"/> | ||
<element/> | ||
</doc> | ||
</p:with-input> | ||
</p:identity> | ||
|
||
<p:compare name="compare" fail-if-not-equal="true"> | ||
<p:with-input port="source" pipe="@doc-a"/> | ||
<p:with-input port="alternate" pipe="@doc-b"/> | ||
</p:compare> | ||
|
||
</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 prefix="c" uri="http://www.w3.org/ns/xproc-step"/> | ||
<s:pattern> | ||
<s:rule context="/"> | ||
<s:assert test="c:result">Root element is not 'c:result'.</s:assert> | ||
<s:assert test="string(c:result)='true'">Result is not ‘true’.</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,54 @@ | ||
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
expected="fail" code="err:XC0019"> | ||
<t:info> | ||
<t:title>p:compare 004 (NW)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-03-26</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Created test for p:compare.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Check if p:compare raises an error when the documents are different and | ||
fail-if-not-equal is true.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" | ||
xmlns:test="http://test" version="3.0"> | ||
<p:output port="result"> | ||
<p:pipe step="compare" port="result"/> | ||
</p:output> | ||
|
||
<p:identity name="doc-a"> | ||
<p:with-input> | ||
<doc> | ||
<element name="first"/> | ||
<element/> | ||
</doc> | ||
</p:with-input> | ||
</p:identity> | ||
|
||
<p:identity name="doc-b"> | ||
<p:with-input> | ||
<doc> | ||
<element name="second"/> | ||
<element/> | ||
</doc> | ||
</p:with-input> | ||
</p:identity> | ||
|
||
<p:compare name="compare" fail-if-not-equal="true"> | ||
<p:with-input port="source" pipe="@doc-a"/> | ||
<p:with-input port="alternate" pipe="@doc-b"/> | ||
</p:compare> | ||
|
||
</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,53 @@ | ||
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
expected="fail" code="err:XC0076"> | ||
<t:info> | ||
<t:title>p:compare 005 (NW)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-03-26</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Created test for p:compare.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Check if p:compare raises an error when the method is unsupported.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" | ||
xmlns:test="http://test" version="3.0"> | ||
<p:output port="result"> | ||
<p:pipe step="compare" port="result"/> | ||
</p:output> | ||
|
||
<p:identity name="doc-a"> | ||
<p:with-input> | ||
<doc> | ||
<element name="first"/> | ||
<element/> | ||
</doc> | ||
</p:with-input> | ||
</p:identity> | ||
|
||
<p:identity name="doc-b"> | ||
<p:with-input> | ||
<doc> | ||
<element name="second"/> | ||
<element/> | ||
</doc> | ||
</p:with-input> | ||
</p:identity> | ||
|
||
<p:compare name="compare" method="an-unsupported-value"> | ||
<p:with-input port="source" pipe="@doc-a"/> | ||
<p:with-input port="alternate" pipe="@doc-b"/> | ||
</p:compare> | ||
|
||
</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,50 @@ | ||
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0" | ||
xmlns:err="http://www.w3.org/ns/xproc-error" | ||
expected="fail" code="err:XC0077"> | ||
<t:info> | ||
<t:title>p:compare 006 (NW)</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2024-03-26</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Created test for p:compare.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Check if p:compare raises an error when the documents cannot be compared.</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" | ||
xmlns:test="http://test" version="3.0"> | ||
<p:output port="result"> | ||
<p:pipe step="compare" port="result"/> | ||
</p:output> | ||
|
||
<p:identity name="doc-a"> | ||
<p:with-input> | ||
<p:inline content-type="text/plain">Not XML.</p:inline> | ||
</p:with-input> | ||
</p:identity> | ||
|
||
<p:identity name="doc-b"> | ||
<p:with-input> | ||
<doc> | ||
<element name="second"/> | ||
<element/> | ||
</doc> | ||
</p:with-input> | ||
</p:identity> | ||
|
||
<p:compare name="compare"> | ||
<p:with-input port="source" pipe="@doc-a"/> | ||
<p:with-input port="alternate" pipe="@doc-b"/> | ||
</p:compare> | ||
|
||
</p:declare-step> | ||
</t:pipeline> | ||
</t:test> |