-
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 #816 from ndw/wrapper-attr
New tests for attributes option
- Loading branch information
Showing
3 changed files
with
173 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,62 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<t:test expected="pass" | ||
xmlns:t="http://xproc.org/ns/testsuite/3.0"> | ||
<t:info> | ||
<t:title>pack 008</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2025-02-01</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.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Testing the new (in 3.1) attributes option on p:pack</p> | ||
</t:description> | ||
<t:pipeline> | ||
<p:declare-step version="3.0" | ||
xmlns:p="http://www.w3.org/ns/xproc"> | ||
<p:output port="result"/> | ||
<p:pack wrapper="wrapper" attributes="map{'pairs': true()}"> | ||
<p:with-input port="source"> | ||
<doc1/> | ||
<doc2/> | ||
<doc3/> | ||
</p:with-input> | ||
<p:with-input port="alternate"> | ||
<doc-a/> | ||
<doc-b/> | ||
<doc-c/> | ||
</p:with-input> | ||
</p:pack> | ||
<p:wrap-sequence wrapper="sequence-wrapper"/> | ||
</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="sequence-wrapper">The document root is not sequence-wrapper.</s:assert> | ||
<s:assert test="sequence-wrapper/wrapper[1]/@pairs = 'true'">wrapper[1] pairs attribute is not correct.</s:assert> | ||
<s:assert test="sequence-wrapper/wrapper[1]/*[1][local-name()='doc1']">wrapper[1]/*[1] is not correct.</s:assert> | ||
<s:assert test="sequence-wrapper/wrapper[1]/*[2][local-name()='doc-a']">wrapper[1]/*[2] is not correct.</s:assert> | ||
<s:assert test="count(sequence-wrapper/wrapper[1]/*)=2">wrapper[1] does not have exactly 2 child elements.</s:assert> | ||
<s:assert test="sequence-wrapper/wrapper[2]/@pairs = 'true'">wrapper[2] pairs attribute is not correct.</s:assert> | ||
<s:assert test="sequence-wrapper/wrapper[2]/*[1][local-name()='doc2']">wrapper[2]/*[1] is not correct.</s:assert> | ||
<s:assert test="sequence-wrapper/wrapper[2]/*[2][local-name()='doc-b']">wrapper[2]/*[1] is not correct.</s:assert> | ||
<s:assert test="count(sequence-wrapper/wrapper[2]/*)=2">wrapper[2] does not have exactly 2 child elements.</s:assert> | ||
<s:assert test="sequence-wrapper/wrapper[3]/@pairs = 'true'">wrapper[3] pairs attribute is not correct.</s:assert> | ||
<s:assert test="sequence-wrapper/wrapper[3]/*[1][local-name()='doc3']">wrapper[3]/*[1] is not correct.</s:assert> | ||
<s:assert test="sequence-wrapper/wrapper[3]/*[2][local-name()='doc-c']">wrapper[3]/*[1] is not correct.</s:assert> | ||
<s:assert test="count(sequence-wrapper/wrapper[3]/*)=2">wrapper[3] does not have exactly 2 child elements.</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,57 @@ | ||
<?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:wrap 013</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2025-02-01</t:date> | ||
<t:author> | ||
<t:name>Achim Berndzen</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Created test.</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Testing the new (in 3.1) attributes option on p:wrap</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:wrap match="element" | ||
wrapper="wrapper" | ||
attributes="map{'wrapped': true()}"> | ||
<p:with-input> | ||
<doc> | ||
<not-matched/> | ||
<element/> | ||
<element/> | ||
<not-matched/> | ||
</doc> | ||
</p:with-input> | ||
</p:wrap> | ||
</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="doc/*[1]/local-name() = 'not-matched'">First child of 'doc' is not 'not-matched'.</s:assert> | ||
<s:assert test="doc/*[2]/local-name() = 'wrapper'">Second child of 'doc' is not 'wrapper'.</s:assert> | ||
<s:assert test="doc/*[2]/@wrapped = 'true'">The wrapped attribute is incorrect on first wrapper.</s:assert> | ||
<s:assert test="doc/*[3]/local-name() = 'wrapper'">Third child of 'doc' is not 'wrapper'.</s:assert> | ||
<s:assert test="doc/*[3]/@wrapped = 'true'">The wrapped attribute is incorrect on second wrapper.</s:assert> | ||
<s:assert test="doc/*[4]/local-name() = 'not-matched'">Forth child of 'doc' is not 'not-matched'.</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 @@ | ||
<?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:wrap-sequence 016</t:title> | ||
<t:revision-history> | ||
<t:revision> | ||
<t:date>2025-02-01</t:date> | ||
<t:author> | ||
<t:name>Norm Tovey-Walsh</t:name> | ||
</t:author> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Tests for p:wrap-sequence (Partly ported from 1.0)</p> | ||
</t:description> | ||
</t:revision> | ||
</t:revision-history> | ||
</t:info> | ||
<t:description xmlns="http://www.w3.org/1999/xhtml"> | ||
<p>Testing the new (in 3.1) attributes option on p:wrap-sequence</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:wrap-sequence wrapper="sequence" | ||
attributes="map{'seq': true()}"> | ||
<p:with-input> | ||
<doc/> | ||
<doc/> | ||
<doc/> | ||
</p:with-input> | ||
</p:wrap-sequence> | ||
</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="sequence">Root element is not 'sequence'.</s:assert> | ||
</s:rule> | ||
</s:pattern> | ||
<s:pattern> | ||
<s:rule context="/sequence"> | ||
<s:assert test="count(*) = 3">Wrong number of children.</s:assert> | ||
<s:assert test="@seq = 'true'">The seq attribute is incorrect.</s:assert> | ||
</s:rule> | ||
</s:pattern> | ||
</s:schema> | ||
</t:schematron> | ||
</t:test> |