Add sequence test for fn:reverse() - Saxon-JS bug 3362
authordlockett <debbie@saxonica.com>
Thu, 17 Aug 2017 11:53:12 +0100
changeset 1745 575cb2f546a5
parent 1744 60ad316ccf04
child 1747 eaccea174847
Add sequence test for fn:reverse() - Saxon-JS bug 3362
tests/insn/sequence/_sequence-test-set.xml
tests/insn/sequence/sequence-2002.xsl
--- a/tests/insn/sequence/_sequence-test-set.xml	Thu Aug 17 10:13:04 2017 +0100
+++ b/tests/insn/sequence/_sequence-test-set.xml	Thu Aug 17 11:53:12 2017 +0100
@@ -1408,6 +1408,21 @@
          <assert-xml><![CDATA[<out>truetrue</out>]]></assert-xml>
       </result>
    </test-case>
+   
+   <test-case name="sequence-2002">
+      <description>xsl:sequence - check reverse() does not modify argument (Saxon-JS bug #3362)</description>
+      <created by="Debbie Lockett" on="2017-08-17"/>
+      <environment ref="sequence-01"/>
+      <dependencies>
+         <spec value="XSLT20+"/>
+      </dependencies>
+      <test>
+         <stylesheet file="sequence-2002.xsl"/>
+      </test>
+      <result>
+         <assert-xml><![CDATA[<out><x1>1 2 3</x1><x2>3 2 1</x2><x3>3 2 1 1 2 3</x3></out>]]></assert-xml>
+      </result>
+   </test-case>
 
    <test-case name="sequence-2101">
       <description>range expression with functions as operands</description>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/insn/sequence/sequence-2002.xsl	Thu Aug 17 11:53:12 2017 +0100
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xslt:transform xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
+                version="2.0"
+                exclude-result-prefixes="xs">
+   <!-- Purpose: xsl:sequence - check reverse() does not modify argument -->
+
+   <xslt:variable name="seq1" as="item()*">
+      <xslt:sequence select="(1,2,3)"/>
+   </xslt:variable>
+
+   <xslt:template match="/">
+      <out>
+         <x1><xslt:value-of select="$seq1"/></x1>
+         <x2><xslt:value-of select="reverse($seq1)"/></x2>
+         <x3><xslt:value-of select="(reverse($seq1),$seq1)"/></x3>
+      </out>
+   </xslt:template>
+</xslt:transform>