Various corrections to current-output-uri tests
authorMichael Kay <mike@saxonica.com>
Mon, 11 Mar 2019 18:11:47 +0000
changeset 2050 fa3f50fa32d3
parent 2045 48cbfb000ccc
child 2051 0847ecabd2c1
Various corrections to current-output-uri tests
tests/fn/current-output-uri/_current-output-uri-test-set.xml
tests/fn/current-output-uri/current-output-uri-006.xsl
tests/fn/current-output-uri/current-output-uri-007.xsl
tests/fn/current-output-uri/current-output-uri-008.xsl
tests/insn/merge/_merge-test-set.xml
tests/insn/merge/merge-029.xsl
tests/insn/next-match/_next-match-test-set.xml
--- a/tests/fn/current-output-uri/_current-output-uri-test-set.xml	Wed Mar 06 17:32:44 2019 +0000
+++ b/tests/fn/current-output-uri/_current-output-uri-test-set.xml	Mon Mar 11 18:11:47 2019 +0000
@@ -54,7 +54,8 @@
    
    <test-case name="current-output-uri-004">
       <description>Value of current-output-uri() in a tunnel parameter</description>
-      <created by="Michael Kay" on="2014-09-16"/> 
+      <created by="Michael Kay" on="2014-09-16"/>
+      <modified by="Michael Kay" on="2019-03-06" change="Test -003 has changed the convention for assert-result-document/@uri; apply the same change here"/>
       <environment>
          <source role="." file="current-output-uri-004.xsl"/>
       </environment>     
@@ -63,7 +64,7 @@
          <output file="results/current-output-uri-004.xml"/>
       </test>
       <result>
-         <assert-result-document uri="results/row1.xml">
+         <assert-result-document uri="row1.xml">
             <assert>ends-with(/row/col/@base, 'results/current-output-uri-004.xml')</assert>
          </assert-result-document>
       </result>
@@ -85,11 +86,12 @@
    
    <test-case name="current-output-uri-006">
       <description>Initial function must operate in temporary output state, current-output-uri() should return empty</description>
-      <created by="Abel Braaksma" on="2019-01-31"/>   
+      <created by="Abel Braaksma" on="2019-01-31"/> 
+      <modified by="Michael Kay" on="2019-03-06" change="make initial function public; add tree=no"/> 
       <test>
          <stylesheet file="current-output-uri-006.xsl"/>
          <initial-function name="f:start" xmlns:f="urn:function"/>
-         <output file="results/current-output-uri-006.xml"/>
+         <output tree="no" serialize="no" file="results/current-output-uri-006.xml"/>
       </test>
       <result>
          <assert-empty />
@@ -100,10 +102,11 @@
    <test-case name="current-output-uri-007">
       <description>Whole stylesheet is in temp output state and current-output-uri() should return empty everywhere</description>
       <created by="Abel Braaksma" on="2019-01-31"/>   
+      <modified by="Michael Kay" on="2019-03-06" change="make initial function public; add tree=no; change to return a single string, not a sequence of text nodes"/> 
       <test>
          <stylesheet file="current-output-uri-007.xsl"/>
          <initial-function name="f:start" xmlns:f="urn:function"/>
-         <output file="results/current-output-uri-007.xml"/>
+         <output tree="no" serialize="no" file="results/current-output-uri-007.xml"/>
       </test>
       <result>
          <assert-string-value>||||||</assert-string-value>
@@ -112,7 +115,8 @@
    
    <test-case name="current-output-uri-008">
       <description>Mix of with and without temp output state for current-output-uri(), initial-template</description>
-      <created by="Abel Braaksma" on="2019-01-31"/>   
+      <created by="Abel Braaksma" on="2019-01-31"/>
+      <modified by="Michael Kay" on="2019-03-06" change="add test for pattern evaluation in xsl:for-each-group"/>
       <test>
          <stylesheet file="current-output-uri-008.xsl"/>
          <initial-template name="start"/>
@@ -127,6 +131,7 @@
             <assert>/result/in-function/output-uri[1][@value = '']</assert>
             <assert>/result/in-function/output-uri[2][@value = '']</assert>
             <assert>/result/in-function/output-uri[3][@correct="output-uri is empty in patterns"]</assert>
+            <assert>/result/in-pattern/group[@at='0']</assert>
          </all-of>
       </result>
    </test-case>   
--- a/tests/fn/current-output-uri/current-output-uri-006.xsl	Wed Mar 06 17:32:44 2019 +0000
+++ b/tests/fn/current-output-uri/current-output-uri-006.xsl	Mon Mar 11 18:11:47 2019 +0000
@@ -6,7 +6,7 @@
     
     <!-- current-output-uri() while evaluating a stylesheet function -->
     
-    <xsl:function name="f:start">
+    <xsl:function name="f:start" visibility="public">
         <xsl:sequence select="current-output-uri()"/>
     </xsl:function>
 
--- a/tests/fn/current-output-uri/current-output-uri-007.xsl	Wed Mar 06 17:32:44 2019 +0000
+++ b/tests/fn/current-output-uri/current-output-uri-007.xsl	Mon Mar 11 18:11:47 2019 +0000
@@ -12,9 +12,11 @@
         </base>
     </xsl:variable>
     
-    <xsl:function name="f:start">
-        <xsl:apply-templates select="$base" />
-        <xsl:call-template name="named" />
+    <xsl:function name="f:start" visibility="public" as="xs:string">
+        <xsl:value-of>
+            <xsl:apply-templates select="$base" />
+            <xsl:call-template name="named" />
+        </xsl:value-of>
     </xsl:function>
     
     <xsl:template match="$base">
--- a/tests/fn/current-output-uri/current-output-uri-008.xsl	Wed Mar 06 17:32:44 2019 +0000
+++ b/tests/fn/current-output-uri/current-output-uri-008.xsl	Mon Mar 11 18:11:47 2019 +0000
@@ -41,6 +41,11 @@
             <in-function>
                 <xsl:copy-of select="f:start()" />
             </in-function>
+            <in-pattern>
+                <xsl:for-each-group select="-1 to +1" group-starting-with=".[.=count(current-output-uri())]">
+                    <group at="{.}"/>
+                </xsl:for-each-group>
+            </in-pattern>
         </result>
     </xsl:template>
 
--- a/tests/insn/merge/_merge-test-set.xml	Wed Mar 06 17:32:44 2019 +0000
+++ b/tests/insn/merge/_merge-test-set.xml	Mon Mar 11 18:11:47 2019 +0000
@@ -433,6 +433,7 @@
       <description>xsl:merge: live use case, see http://stackoverflow.com/questions/10271639/xslt-merge-challenge</description>
       <created by="Michael Kay" on="2012-11-07"/>
       <modified by="Abel Braaksma" on="2018-12-22" change="Replaced CDATA XML with standard XML file (same data, no indentation)"/>
+      <modified by="Michael Kay" on="2019-03-06" change="Revert changes to .xsl file, which appear to have been made for diagnostic purposes"/>
       <test>
          <stylesheet file="merge-029.xsl"/>
          <initial-template name="main"/>
--- a/tests/insn/merge/merge-029.xsl	Wed Mar 06 17:32:44 2019 +0000
+++ b/tests/insn/merge/merge-029.xsl	Mon Mar 11 18:11:47 2019 +0000
@@ -26,17 +26,9 @@
             if (count(current-merge-group()) = 1)
             then if (current-merge-group()[1]/root(.) is $original) then 'Deleted' else 'New'
             else if (deep-equal(current-merge-group()[1], current-merge-group()[2])) then 'NoChange' else 'Updated'"/>
-          <groups>
-            <CurrentMergeGroup>
-              <xsl:copy-of select="current-merge-group()[1]" />
-            </CurrentMergeGroup>
-            <CurrentMergeGroup>
-              <xsl:copy-of select="current-merge-group()[2]" />
-            </CurrentMergeGroup>
-            <CurrentMergeGroup>
-              <xsl:copy-of select="current-merge-group()[3]" />
-            </CurrentMergeGroup>
-          </groups>
+          <Address status="{$status}">
+            <xsl:copy-of select="current-merge-group()[1]/(AddressesId, Street)"/>
+          </Address>
         </xsl:merge-action>
       </xsl:merge>
     </Addresses>
--- a/tests/insn/next-match/_next-match-test-set.xml	Wed Mar 06 17:32:44 2019 +0000
+++ b/tests/insn/next-match/_next-match-test-set.xml	Mon Mar 11 18:11:47 2019 +0000
@@ -702,4 +702,21 @@
          <assert-xml><![CDATA[<out><one>one time</one><one>one time</one><two>finally</two></out>]]></assert-xml>
       </result>
    </test-case>
+   
+   <test-case name="next-match-040">
+      <description>Test of xsl:next-match across package boundaries. Variant of -036 in which the mode is accepted as final rather than public</description>
+      <created by="Michael Kay" on="2019-03-07"/>
+      <environment ref="next-match022"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+      </dependencies>
+      <test>
+         <package name="http://xslt-tests/next-match-036-lib" uri="http://xslt-tests/next-match-036-lib" file="next-match-036-lib.xsl" role="secondary"/>
+         <stylesheet file="next-match-040.xsl"/>
+         <initial-mode name="m"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out><tag2><tag>Example of apply-imports</tag></tag2><bag>Example of apply-templates</bag></out>]]></assert-xml>
+      </result>
+   </test-case>
 </test-set>