tests/decl/override/_override-test-set.xml
author Michael Kay <mike@saxonica.com>
Tue, 18 Aug 2015 18:22:28 +0100
changeset 1045 6d51333a8d63
parent 1015 b7ec635012c5
child 1066 eb9be73e24d7
permissions -rw-r--r--
Various corrections to xsl:override tests
<?xml version="1.0" encoding="UTF-8"?>
<test-set xmlns:xs="http://www.w3.org/2001/XMLSchema"
          xmlns="http://www.w3.org/2012/10/xslt-test-catalog"
          name="override">
   <description>Tests xsl:override in XSLT 3.0</description>
   
   <environment name="override-f-A">
      <package file="override-base-f-001.xsl" role="secondary" uri="http://www.w3.org/xslt30tests/override-base-001" package-version="1.0.0"/>
   </environment>
   
   <environment name="override-t-B">
      <package file="override-base-t-001.xsl" role="secondary" uri="http://www.w3.org/xslt30tests/override-base-101" package-version="1.0.0"/>
   </environment>
   
   <environment name="override-v-C">
      <package file="override-base-v-001.xsl" role="secondary" uri="http://www.w3.org/xslt30tests/override-base-201" package-version="1.0.0"/>
   </environment>
   
   <environment name="override-as-D">
      <package file="override-base-as-001.xsl" role="secondary" uri="http://www.w3.org/xslt30tests/override-base-301" package-version="1.0.0"/>
   </environment>
   
   <environment name="override-misc-E">
      <package file="override-base-misc-001.xsl" role="secondary" uri="http://www.w3.org/xslt30tests/override-base-901" package-version="1.0.0"/>
   </environment>
   
   <environment name="override-misc-F">
      <package file="override-base-misc-002.xsl" role="secondary" uri="http://www.w3.org/xslt30tests/override-base-misc-002" package-version="1.0.0"/>
   </environment>

   <dependencies>
      <spec value="XSLT30+"/> 
   </dependencies>

   <test-case name="override-f-001">
      <description>Successful override of a function</description>
      <created by="Michael Kay" on="2013-07-08"/>
      <modified by="Michael Kay" on="2014-08-22" change="no xsl:stylesheet child of xsl:package"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-001.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/ok</assert>
      </result>
   </test-case>
   
   <test-case name="override-f-002">
      <description>Successful use of override of a function defined in a library package</description>
      <created by="O'Neil Delpratt" on="2013-07-17"/>
      <modified by="Michael Kay" on="2014-08-22" change="no xsl:stylesheet child of xsl:package"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-002.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/ok</assert>
      </result>
   </test-case>
   
   <test-case name="override-f-003">
      <description>Unsuccessful use of override of a function defined in a library package. Parameter types are different</description>
      <created by="O'Neil Delpratt" on="2013-07-17"/>
      <modified by="Michael Kay" on="2014-08-22" change="no xsl:stylesheet child of xsl:package"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-003.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <error code="XTSE3070"/>
      </result>
   </test-case>
   
   <test-case name="override-f-004">
      <description>Unsuccessful use of override of a function as it is not defined in a library package.</description>
      <created by="O'Neil Delpratt" on="2013-07-17"/>
      <modified by="Michael Kay" on="2014-08-22" change="no xsl:stylesheet child of xsl:package"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-004.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <error code="XTSE3058"/>
      </result>
   </test-case>
   
   <test-case name="override-f-005">
      <description>Disallow text as a child of xsl:override.</description>
      <created by="Michael Kay" on="2013-07-19"/>
      <modified by="Michael Kay" on="2014-08-22" change="no xsl:stylesheet child of xsl:package"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-005.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <error code="XTSE0010"/>
      </result>
   </test-case>  
   
   <test-case name="override-f-006">
      <description>Disallow LRE as a child of xsl:override.</description>
      <created by="Michael Kay" on="2013-07-19"/>
      <modified by="Michael Kay" on="2014-08-22" change="no xsl:stylesheet child of xsl:package"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-006.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <error code="XTSE0010"/>
      </result>
   </test-case> 
   
   <test-case name="override-f-007">
      <description>Disallow xsl:override as a child of xsl:override.</description>
      <created by="Michael Kay" on="2013-07-19"/>
      <modified by="Michael Kay" on="2014-08-22" change="no xsl:stylesheet child of xsl:package"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-007.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <error code="XTSE0010"/>
      </result>
   </test-case>
   
   <test-case name="override-f-008">
      <description>Empty xsl:override is allowed.</description>
      <created by="Michael Kay" on="2013-07-19"/>
      <modified by="Michael Kay" on="2014-08-22" change="no xsl:stylesheet child of xsl:package"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-008.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/out</assert>
      </result>
   </test-case>
   
   <test-case name="override-f-009">
      <description>Overridden function called from within a stylesheet function</description>
      <created by="Michael Kay" on="2013-10-17"/>
      <modified by="Michael Kay" on="2014-08-22" change="no xsl:stylesheet child of xsl:package"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-009.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/ok</assert>
      </result>
   </test-case>
   
   <test-case name="override-f-010">
      <description>Overridden function called from within a global variable initializer</description>
      <created by="Michael Kay" on="2013-10-17"/>
      <modified by="Michael Kay" on="2014-08-22" change="no xsl:stylesheet child of xsl:package"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-010.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/ok</assert>
      </result>
   </test-case>
   
   <test-case name="override-f-011">
      <description>Overridden function called from within a template rule</description>
      <created by="Michael Kay" on="2013-10-17"/>
      <modified by="Michael Kay" on="2014-08-22" change="no xsl:stylesheet child of xsl:package"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-011.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/ok</assert>
      </result>
   </test-case>
   
   <test-case name="override-f-012">
      <description>Overridden function called from within a global variable in used package</description>
      <created by="Michael Kay" on="2013-10-17"/>
      <modified by="Michael Kay" on="2014-08-22" change="no xsl:stylesheet child of xsl:package"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-012.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/ok</assert>
      </result>
   </test-case>
   
   <test-case name="override-f-013">
      <description>Overridden function called via function reference in used package</description>
      <created by="Michael Kay" on="2015-02-28"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-013.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/ok</assert>
      </result>
   </test-case>
   
   <test-case name="override-f-014">
      <description>Private function called via function reference in used package</description>
      <created by="Michael Kay" on="2015-02-28"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-014.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/ok</assert>
      </result>
   </test-case>
   
   <test-case name="override-f-015">
      <description>Partial function application of an overridden function</description>
      <!-- Currently (2015-02-28) failing in Saxon because we're binding statically to the target function -->
      <created by="Michael Kay" on="2015-02-28"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-015.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/ok</assert>
      </result>
   </test-case>
   
   <test-case name="override-f-016">
      <description>A function call using xsl:original</description>
      <created by="Michael Kay" on="2015-03-01"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-016.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/ok</assert>
      </result>
   </test-case>
   
   <test-case name="override-f-017">
      <description>A named function reference using xsl:original</description>
      <created by="Michael Kay" on="2015-03-01"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-017.xsl" role="principal"/>
         <initial-template name="xsl:initial-template" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
      </test>
      <result>
         <assert>/ok</assert>
      </result>
   </test-case>
   
   <test-case name="override-f-018">
      <description>Partial function application using xsl:original</description>
      <created by="Michael Kay" on="2015-03-01"/>
      <environment ref="override-f-A"/>
      <test>
         <package file="override-f-018.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/ok</assert>
      </result>
   </test-case>
   
   <test-case name="override-t-001">
      <description>Successful override of a named template, when called from overriding package</description>
      <created by="Michael Kay" on="2013-07-31"/>
      <modified by="Michael Kay" on="2014-08-22" change="no xsl:stylesheet child of xsl:package"/>
      <environment ref="override-t-B"/>
      <test>
         <package file="override-t-001.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/out = '*xxxxx*'</assert>
      </result>
   </test-case>  
   
   <test-case name="override-t-002">
      <description>Successful override of a named template, when called from base package</description>
      <created by="Michael Kay" on="2013-07-31"/>
      <modified by="Michael Kay" on="2014-08-22" change="no xsl:stylesheet child of xsl:package"/>
      <environment ref="override-t-B"/>
      <test>
         <package file="override-t-002.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/out = '*xxxxx*'</assert>
      </result>
   </test-case>   
   
   <test-case name="override-t-003">
      <description>Cannot call an abstract template</description>
      <created by="Michael Kay" on="2013-07-31"/>
      <modified by="Michael Kay" on="2014-08-22" change="no xsl:stylesheet child of xsl:package"/>
      <environment ref="override-t-B"/>
      <test>
         <package file="override-t-003.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <error code="XTSE3080"/>
      </result>
   </test-case>
   
   <test-case name="override-t-004">
      <description>Illegal template override, parameter types do not match</description>
      <created by="Michael Kay" on="2014-10-10"/>
      <modified by="Michael Kay" on="2015-08-18" change="correct expected error code"/>
      <environment ref="override-t-B"/>
      <test>
         <package file="override-t-004.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <error code="XTSE3070"/>
      </result>
   </test-case>
   
   <test-case name="override-t-005">
      <description>Illegal template override, context item types do not match</description>
      <created by="Michael Kay" on="2014-10-10"/>
      <modified by="Michael Kay" on="2015-08-18" change="correct expected error code"/>
      <environment ref="override-t-B"/>
      <test>
         <package file="override-t-005.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <error code="XTSE3070"/>
      </result>
   </test-case>
   
   <test-case name="override-t-006">
      <description>Illegal template override, context item use does not match</description>
      <created by="Michael Kay" on="2014-10-10"/>
      <modified by="Michael Kay" on="2015-01-26" change="keyword change: prohibited -> absent"/>
      <modified by="Michael Kay" on="2015-08-18" change="correct expected error code"/>
      <environment ref="override-t-B"/>
      <test>
         <package file="override-t-006.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <error code="XTSE3070"/>
      </result>
   </test-case>
   
   <test-case name="override-t-007">
      <description>A named template calling xsl:original</description>
      <created by="Michael Kay" on="2015-03-01"/>
      <environment ref="override-t-B"/>
      <test>
         <package file="override-t-007.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/out = '*xxxxx*'</assert>
      </result>
   </test-case>  

   <test-case name="override-v-001">
      <description>Successful override of a public global variable</description>
      <created by="Michael Kay" on="2013-10-18"/>
      <modified by="Michael Kay" on="2014-08-22" change="no xsl:stylesheet child of xsl:package"/>
      <environment ref="override-v-C"/>
      <test>
         <package file="override-v-001.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/ok</assert>
      </result>
   </test-case>
   
   <test-case name="override-v-002">
      <description>Reference from private variable to overridden public variable</description>
      <created by="Michael Kay" on="2013-10-18"/>
      <modified by="Michael Kay" on="2014-08-22" change="no xsl:stylesheet child of xsl:package"/>
      <environment ref="override-v-C"/>
      <test>
         <package file="override-v-002.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/ok</assert>
      </result>
   </test-case>
   
   <test-case name="override-v-003">
      <description>An overridden public global variable using xsl:original</description>
      <created by="Michael Kay" on="2015-03-01"/>
      <environment ref="override-v-C"/>
      <test>
         <package file="override-v-003.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/ok</assert>
      </result>
   </test-case>
   
   <test-case name="override-v-004">
      <description>An overridden public global variable appearing in a match pattern</description>
      <!-- MHK: Not currently working in Saxon, needs to treat the mode as a component with a single binding vector -->
      <created by="Michael Kay" on="2015-03-01"/>
      <environment ref="override-v-C"/>
      <test>
         <package file="override-v-004.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert>/go/not-one</assert>
      </result>
   </test-case>
   
   <test-case name="override-as-001">
      <description>Successful override of a public attribute-set</description>
      <created by="Michael Kay" on="2015-02-28"/>
      <environment ref="override-as-D"/>
      <test>
         <package file="override-as-001.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert-xml><![CDATA[<out><x pub1="pub1o" pub2="pub2o"/><y abs1="abs1o" abs2="abs2o"/><z final1="final1"/></out>]]></assert-xml>
      </result>
   </test-case>
   
   <test-case name="override-as-002">
      <description>Successful override of a public attribute-set with use-attribute-sets="xsl:original"</description>
      <created by="Michael Kay" on="2015-02-28"/>
      <environment ref="override-as-D"/>
      <test>
         <package file="override-as-002.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert-xml><![CDATA[<out><x base1="base1"
      priv1="priv1"
      pub1="pub1o"
      pub2="pub2"
      pub3="pub3o"/><y abs1="abs1o" abs2="abs2o"/><z final1="final1"/></out>]]></assert-xml>
      </result>
   </test-case>
   
   <test-case name="override-as-003">
      <description>Override of a public attribute-set creates a circularity</description>
      <created by="Michael Kay" on="2015-02-28"/>
      <environment ref="override-as-D"/>
      <test>
         <package file="override-as-003.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <error code="XTDE0640"/>
      </result>
   </test-case>
   
   <test-case name="override-as-004">
      <description>Attempt to override a private attribute-set</description>
      <created by="Michael Kay" on="2015-02-28"/>
      <environment ref="override-as-D"/>
      <test>
         <package file="override-as-004.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <error code="XTSE3060"/>
      </result>
   </test-case>
   
   <test-case name="override-as-005">
      <description>Two private attribute sets with the same name in different packages</description>
      <created by="Michael Kay" on="2015-02-28"/>
      <modified by="Michael Kay" on="2015-08-18" change="correct expected results"/>
      <environment ref="override-as-D"/>
      <test>
         <package file="override-as-005.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert-xml><![CDATA[<out><x base1="base1" priv1="priv1" pub1="pub1" pub2="pub2"/><y priv8="priv8" priv9="priv9"/></out>]]></assert-xml>
      </result>
   </test-case>
   
   
   <test-case name="override-misc-001">
      <description>Cannot override a key</description>
      <created by="Michael Kay" on="2015-03-01"/>
      <environment ref="override-misc-E"/>
      <test>
         <package file="override-misc-001.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <error code="XTSE0010"/>
      </result>
   </test-case>
   
   <test-case name="override-misc-002">
      <description>Cannot override an accumulator</description>
      <created by="Michael Kay" on="2015-03-01"/>
      <environment ref="override-misc-E"/>
      <test>
         <package file="override-misc-002.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <error code="XTSE0010"/>
      </result>
   </test-case>
   
   <test-case name="override-misc-003">
      <description>Cannot override a decimal format</description>
      <created by="Michael Kay" on="2015-03-01"/>
      <environment ref="override-misc-E"/>
      <test>
         <package file="override-misc-003.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <error code="XTSE0010"/>
      </result>
   </test-case>
   
   <test-case name="override-misc-004">
      <description>Keys in different packages can have the same name</description>
      <created by="Michael Kay" on="2015-03-01"/>
      <environment ref="override-misc-E"/>
      <test>
         <package file="override-misc-004.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert-xml><![CDATA[<out><a><x>y</x></a><b><e>x</e></b></out>]]></assert-xml>
      </result>
   </test-case>
   
   <test-case name="override-misc-005">
      <description>Accumulators in different packages can have the same name</description>
      <created by="Michael Kay" on="2015-03-01"/>
      <modified by="Michael Kay" on="2014-08-22" change="spec change, @new-value->@select"/>
      <environment ref="override-misc-E"/>
      <test>
         <package file="override-misc-005.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert-xml><![CDATA[<out><a>-3</a><b>3</b></out>]]></assert-xml>
      </result>
   </test-case>
   
   <test-case name="override-misc-006">
      <description>Decimal formats in different packages can have the same name</description>
      <created by="Michael Kay" on="2015-03-01"/>
      <environment ref="override-misc-E"/>
      <test>
         <package file="override-misc-006.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert-xml><![CDATA[<out><a>123!456:78</a><b>123.456,78</b></out>]]></assert-xml>
      </result>
   </test-case>
   
   <test-case name="override-misc-007">
      <description>Streamed accumulators in different packages can have the same name</description>
      <created by="Michael Kay" on="2015-03-01"/>
      <modified by="Michael Kay" on="2014-08-22" change="spec change, @new-value->@select"/>
      <environment ref="override-misc-F"/>
      <test>
         <package file="override-misc-007.xsl" role="principal"/>
         <initial-template name="main"/>
      </test>
      <result>
         <assert-xml><![CDATA[<out><a><count nodes="78"/><acc value="78"/></a><b><count nodes="78"/><acc value="-78"/></b></out>]]></assert-xml>
      </result>
   </test-case>
   
      
  


</test-set>