Several new tests for streamable stylesheet functions
authorabraaksm
Thu, 14 Jan 2016 17:53:54 +0100
changeset 1202 8215c06f7661
parent 1201 5fe86a4739be
child 1203 73afeb87fe97
Several new tests for streamable stylesheet functions
tests/attr/use-when/use-when-0600.xsl
tests/decl/function/_function-test-set.xml
tests/decl/function/function-5001.xsl
tests/decl/function/function-5002.xsl
tests/decl/function/function-5003.xsl
tests/decl/function/function-5004.xsl
tests/decl/function/function-5005.xsl
tests/decl/function/function-5006.xsl
tests/decl/function/function-5007.xsl
tests/decl/function/function-5011.xsl
tests/decl/function/function-5012.xsl
tests/decl/function/function-5013.xsl
tests/decl/function/function-5014.xsl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/attr/use-when/use-when-0600.xsl	Thu Jan 14 17:53:54 2016 +0100
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ext="http://example.com/extension-instructions-dont-exist" xmlns:map="http://www.w3.org/2005/xpath-functions/map" xmlns:my="http://myfunctions" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="3.0">
+   <xsl:output indent="yes"/>
+   <xsl:template name="xsl:initial-template" expand-text="true" _use-when="{let $f := substring-before#2(?, '-') return $f('true()-now')}">
+      <hello>      
+         <function >
+            {let $f := substring-before#2(?, '-') return $f('true()-now')}
+         </function>         
+      </hello>
+   </xsl:template>
+</xsl:transform>
--- a/tests/decl/function/_function-test-set.xml	Mon Jan 11 11:29:56 2016 +0000
+++ b/tests/decl/function/_function-test-set.xml	Thu Jan 14 17:53:54 2016 +0100
@@ -1523,4 +1523,229 @@
          <error code="XTSE0080"/>
       </result>
    </test-case>
+
+   <!-- note (AB): 5xxx tests are streaming tests, perhaps they should be moved elsewhere? -->
+   <test-case name="function-5001">
+      <description>Base test SC: unclassified, making sure no error is raised</description>
+      <created by="Abel Braaksma" on="2015-12-31"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+         <feature value="streaming" satisfied="true"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-5001.xsl"/>
+      </test>
+      <result>
+         <assert>/p[. = 'Hello again.']</assert>
+      </result>
+   </test-case>
+
+   <test-case name="function-5002">
+      <description>Base test SC: absorbing, making sure no error is raised</description>
+      <created by="Abel Braaksma" on="2015-12-31"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+         <feature value="streaming" satisfied="true"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-5002.xsl"/>
+      </test>
+      <result>
+         <assert>/p[. = 'Hello again.']</assert>
+      </result>
+   </test-case>
+
+   <test-case name="function-5003">
+      <description>Base test SC: inspection, making sure no error is raised</description>
+      <created by="Abel Braaksma" on="2015-12-31"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+         <feature value="streaming" satisfied="true"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-5003.xsl"/>
+      </test>
+      <result>
+         <assert>/p[. = 'Hello again.']</assert>
+      </result>
+   </test-case>
+
+   <test-case name="function-5004">
+      <description>Base test SC: filter, making sure no error is raised</description>
+      <created by="Abel Braaksma" on="2015-12-31"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+         <feature value="streaming" satisfied="true"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-5004.xsl"/>
+      </test>
+      <result>
+         <assert>/p[. = 'Hello again.']</assert>
+      </result>
+   </test-case>
+
+   <test-case name="function-5005">
+      <description>Base test SC: shallow-descent, making sure no error is raised</description>
+      <created by="Abel Braaksma" on="2015-12-31"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+         <feature value="streaming" satisfied="true"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-5005.xsl"/>
+      </test>
+      <result>
+         <assert>/p[. = 'Hello again.']</assert>
+      </result>
+   </test-case>
+
+   <test-case name="function-5006">
+      <description>Base test SC: deep-descent, making sure no error is raised</description>
+      <created by="Abel Braaksma" on="2015-12-31"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+         <feature value="streaming" satisfied="true"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-5006.xsl"/>
+      </test>
+      <result>
+         <assert>/p[. = 'Hello again.']</assert>
+      </result>
+   </test-case>
+   
+   <test-case name="function-5007">
+      <description>Base test SC: ascent, making sure no error is raised</description>
+      <created by="Abel Braaksma" on="2015-12-31"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+         <feature value="streaming" satisfied="true"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-5007.xsl"/>
+      </test>
+      <result>
+         <assert>/p[. = 'Hello again.']</assert>
+      </result>
+   </test-case>
+
+   <test-case name="function-5011">
+      <description>Base test SC: unclassified, making sure no error is raised</description>
+      <created by="Abel Braaksma" on="2015-12-31"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+         <feature value="streaming" satisfied="true"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-5011.xsl"/>
+      </test>
+      <result>
+         <assert>/p[. = 'Hello again.']</assert>
+      </result>
+   </test-case>
+
+   <test-case name="function-5012">
+      <description>Base test SC: absorbing, making sure no error is raised</description>
+      <created by="Abel Braaksma" on="2015-12-31"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+         <feature value="streaming" satisfied="true"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-5012.xsl"/>
+      </test>
+      <result>
+         <assert>/p[. = 'Hello again.']</assert>
+      </result>
+   </test-case>
+
+   <test-case name="function-5013">
+      <description>Base test SC: inspection, making sure no error is raised</description>
+      <created by="Abel Braaksma" on="2015-12-31"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+         <feature value="streaming" satisfied="true"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-5013.xsl"/>
+      </test>
+      <result>
+         <assert>/p[. = 'Hello again.']</assert>
+      </result>
+   </test-case>
+
+   <test-case name="function-5014">
+      <description>Base test SC: filter, making sure no error is raised</description>
+      <created by="Abel Braaksma" on="2015-12-31"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+         <feature value="streaming" satisfied="true"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-5014.xsl"/>
+      </test>
+      <result>
+         <assert>/p[. = 'Hello again.']</assert>
+      </result>
+   </test-case>
+
+   <test-case name="function-5015">
+      <description>Base test SC: shallow-descent, making sure no error is raised</description>
+      <created by="Abel Braaksma" on="2015-12-31"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+         <feature value="streaming" satisfied="true"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-5015.xsl"/>
+      </test>
+      <result>
+         <assert>/p[. = 'Hello again.']</assert>
+      </result>
+   </test-case>
+
+   <test-case name="function-5016">
+      <description>Base test SC: deep-descent, making sure no error is raised</description>
+      <created by="Abel Braaksma" on="2015-12-31"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+         <feature value="streaming" satisfied="true"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-5016.xsl"/>
+      </test>
+      <result>
+         <assert>/p[. = 'Hello again.']</assert>
+      </result>
+   </test-case>
+   
+   <test-case name="function-5017">
+      <description>Base test SC: ascent, making sure no error is raised</description>
+      <created by="Abel Braaksma" on="2015-12-31"/>
+      <environment ref="function-01"/>
+      <dependencies>
+         <spec value="XSLT30+"/>
+         <feature value="streaming" satisfied="true"/>
+      </dependencies>
+      <test>
+         <stylesheet file="function-5017.xsl"/>
+      </test>
+      <result>
+         <assert>/p[. = 'Hello again.']</assert>
+      </result>
+   </test-case>
 </test-set>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-5001.xsl	Thu Jan 14 17:53:54 2016 +0100
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:sf="http://streamable-functions"
+    version="3.0">
+    
+    <xsl:mode streamable="yes" />
+    
+    <xsl:template match="/">
+        <xsl:copy-of select="sf:unclassified(copy-of(.))" />
+    </xsl:template>
+    
+    <xsl:function name="sf:unclassified" streamability="unclassified">
+        <xsl:param name="node" />
+        <xsl:copy-of select="$node/doc/section[1]/section/p[2]" />
+    </xsl:function>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-5002.xsl	Thu Jan 14 17:53:54 2016 +0100
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:sf="http://streamable-functions"
+    version="3.0">
+    
+    <xsl:mode streamable="yes" />
+    
+    <xsl:template match="/">
+        <xsl:copy-of select="sf:absorbing(.)" />
+    </xsl:template>
+    
+    <xsl:function name="sf:absorbing" streamability="absorbing">
+        <xsl:param name="node" />
+        <xsl:copy-of select="$node/doc/section[1]/section/p[2]" />
+    </xsl:function>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-5003.xsl	Thu Jan 14 17:53:54 2016 +0100
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:sf="http://streamable-functions"
+    version="3.0">
+    
+    <xsl:mode streamable="yes" />
+    
+    <xsl:template match="/">
+        <xsl:if test="sf:inspection(.)" >
+            <xsl:copy-of select="doc/section[1]/section/p[2]" />
+        </xsl:if>
+    </xsl:template>
+    
+    <xsl:function name="sf:inspection" streamability="inspection" as="xs:boolean">
+        <xsl:param name="node" as="node()"/>
+        <xsl:sequence select="$node instance of document-node()" />
+    </xsl:function>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-5004.xsl	Thu Jan 14 17:53:54 2016 +0100
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:sf="http://streamable-functions"
+    version="3.0">
+    
+    <xsl:mode streamable="yes" />
+    
+    <xsl:template match="/">
+        <xsl:copy-of select="doc/sf:filter(section[1])/section/p[2]" />
+    </xsl:template>
+    
+    <xsl:function name="sf:filter" streamability="filter"  as="node()">
+        <xsl:param name="node" as="node()"/>
+        <xsl:sequence select="$node[local-name() = 'section']" />
+    </xsl:function>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-5005.xsl	Thu Jan 14 17:53:54 2016 +0100
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:sf="http://streamable-functions"
+    version="3.0">
+    
+    <xsl:mode streamable="yes" />
+    
+    <xsl:template match="/">
+        <xsl:copy-of select="doc/sf:shallow-descent(section[1])/p[2]" />
+    </xsl:template>
+    
+    <xsl:function name="sf:shallow-descent" streamability="shallow-desccent"  as="node()*">
+        <xsl:param name="node" as="node()"/>
+        <xsl:sequence select="$node/section" />
+    </xsl:function>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-5006.xsl	Thu Jan 14 17:53:54 2016 +0100
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:sf="http://streamable-functions"
+    version="3.0">
+    
+    <xsl:mode streamable="yes" />
+    
+    <xsl:template match="/">
+        <xsl:copy-of select="doc/sf:deep-descent(section[1])/p[2]" />
+    </xsl:template>
+    
+    <xsl:function name="sf:deep-descent" streamability="deep-descent" as="node()*">
+        <xsl:param name="node" as="node()"/>
+        <xsl:sequence select="$node//section" />
+    </xsl:function>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-5007.xsl	Thu Jan 14 17:53:54 2016 +0100
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:sf="http://streamable-functions"
+    version="3.0">
+    
+    <xsl:mode streamable="yes" />
+    
+    <xsl:template match="/">
+        <xsl:copy-of select="*/section[1][sf:ascent(.)/local-name() = 'doc']/section/p[2]" />
+    </xsl:template>
+    
+    <xsl:function name="sf:ascent" streamability="ascent" as="node()*">
+        <xsl:param name="node" as="node()"/>
+        <xsl:sequence select="$node/ancestor-or-self::*[last()]" />
+    </xsl:function>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-5011.xsl	Thu Jan 14 17:53:54 2016 +0100
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:sf="http://streamable-functions"
+    version="3.0">
+    
+    <xsl:mode streamable="yes" />
+    
+    <xsl:template match="/">
+        <xsl:copy-of select="(doc/section/sf:unclassified(copy-of(.))[self::new]/p)[1]" />
+    </xsl:template>
+    
+    <xsl:function name="sf:unclassified" streamability="unclassified" as="node()">
+        <xsl:param name="node" />
+        <new>
+            <xsl:copy-of select="$node/section/p[2]" />
+        </new>
+    </xsl:function>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-5012.xsl	Thu Jan 14 17:53:54 2016 +0100
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:sf="http://streamable-functions"
+    version="3.0">
+    
+    <xsl:mode streamable="yes" />
+    
+    <xsl:template match="/">
+        <xsl:copy-of select="(doc/section/sf:absorbing(.)[self::new]/p)[1]" />
+    </xsl:template>
+    
+    <xsl:function name="sf:absorbing" streamability="absorbing" as="node()">
+        <xsl:param name="node" />
+        <new>
+            <xsl:copy-of select="$node/section/p[2]" />
+        </new>
+    </xsl:function>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-5013.xsl	Thu Jan 14 17:53:54 2016 +0100
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:sf="http://streamable-functions"
+    version="3.0">
+    
+    <xsl:mode streamable="yes" />
+    
+    <xsl:template match="/">
+        <xsl:if test="sf:inspection(.)" >
+            <xsl:copy-of select="doc/section[position() = 1 and sf:inspection(.) = false()]/section/p[2][sf:inspection(.) = false()]" />
+        </xsl:if>
+    </xsl:template>
+    
+    <xsl:function name="sf:inspection" streamability="inspection" as="xs:boolean">
+        <xsl:param name="node" as="node()"/>
+        <xsl:sequence select="$node instance of document-node()" />
+    </xsl:function>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/decl/function/function-5014.xsl	Thu Jan 14 17:53:54 2016 +0100
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:sf="http://streamable-functions"
+    version="3.0">
+    
+    <xsl:mode streamable="yes" />
+    
+    <xsl:template match="/">
+        <xsl:copy-of select="doc/sf:filter(section[1])/sf:filter(section)[sf:filter(self::section)]/p[2]" />
+    </xsl:template>
+    
+    <xsl:function name="sf:filter" streamability="filter"  as="node()">
+        <xsl:param name="node" as="node()"/>
+        <xsl:sequence select="$node[local-name() = 'section']" />
+    </xsl:function>
+</xsl:stylesheet>
\ No newline at end of file