Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation warning for Saxon 9.7 or less #625

Merged
merged 15 commits into from Sep 19, 2019
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -21,6 +21,8 @@ env:
- SAXON_VERSION=9.8.0-15
# Saxon version used in oXygen
- SAXON_VERSION=9.8.0-12
# highest deprecated Saxon version
- SAXON_VERSION=9.7.0-21

before_install:
- unset _JAVA_OPTIONS
Expand Down
2 changes: 2 additions & 0 deletions appveyor.yml
Expand Up @@ -18,6 +18,8 @@ environment:
- SAXON_VERSION: 9.8.0-15
# Saxon version used in oXygen
- SAXON_VERSION: 9.8.0-12
# highest deprecated Saxon version
# - SAXON_VERSION: 9.7.0-21

install:
- ps: >-
Expand Down
9 changes: 9 additions & 0 deletions src/compiler/generate-common-tests.xsl
Expand Up @@ -54,6 +54,15 @@
the x:description element, in the mode
-->
<xsl:template name="x:generate-tests">
<xsl:variable name="deprecation-warning" as="xs:string?" select="
if (x:saxon-version() lt x:pack-version(9,8,0,0))
then 'Saxon version 9.7 or less is deprecated. XSpec will stop supporting it in the near future.'
else ()" />
<xsl:message select="
if ($deprecation-warning)
then ('WARNING:', $deprecation-warning)
else ' ' (: Always write a single non-empty line to help Bats tests to predict line numbers. :)" />

<xsl:variable name="description-name" as="xs:QName" select="xs:QName('x:description')" />
<xsl:if test="not(node-name(element()) eq $description-name)">
<xsl:message terminate="yes">
Expand Down
12 changes: 12 additions & 0 deletions test/ant/build.xml
Expand Up @@ -37,6 +37,17 @@
</condition>
<echo message="xslt.supports.schema=${xslt.supports.schema}" />

<!-- Checks to see if XSLT processor supports 3.0 -->
<java classname="net.sf.saxon.Transform" classpath="${java.class.path}" fork="true"
resultproperty="xslt3-0.compile.result">
<arg value="-nogo" />
<arg value="-xsl:${run-xspec-tests.basedir}/caps/v3-0.xsl" />
</java>
<condition else="false" property="xslt.supports.3-0">
<equals arg1="${xslt3-0.compile.result}" arg2="0" />
</condition>
<echo message="xslt.supports.3-0=${xslt.supports.3-0}" />

<!-- Checks to see if XQuery processor can be schema-aware ('-sa') -->
<java classname="net.sf.saxon.Query" classpath="${java.class.path}" fork="true"
resultproperty="xquery.schema-aware.run.result">
Expand Down Expand Up @@ -79,6 +90,7 @@
<param expression="${xslt.supports.coverage}" name="XSLT-SUPPORTS-COVERAGE"
type="BOOLEAN" />
<param expression="${xslt.supports.schema}" name="XSLT-SUPPORTS-SCHEMA" type="BOOLEAN" />
<param expression="${xslt.supports.3-0}" name="XSLT-SUPPORTS-3-0" type="BOOLEAN" />
<param expression="${xquery.supports.schema}" name="XQUERY-SUPPORTS-SCHEMA"
type="BOOLEAN" />
<param expression="${xquery.supports.3-1.default}" name="XQUERY-SUPPORTS-3-1-DEFAULT"
Expand Down
10 changes: 10 additions & 0 deletions test/ant/caps/v3-0.xsl
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file is just for checking to see if the XSLT processor is able to compile version 3.0 -->
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match=".">
<xsl:sequence select="
let $map := map {'foo': 'bar'}
return
$map?foo" />
</xsl:template>
</xsl:stylesheet>
16 changes: 16 additions & 0 deletions test/ant/worker/generate.xsl
Expand Up @@ -19,6 +19,7 @@
<!-- XSLT processor capabilities -->
<xsl:param as="xs:boolean" name="XSLT-SUPPORTS-COVERAGE" required="yes" />
<xsl:param as="xs:boolean" name="XSLT-SUPPORTS-SCHEMA" required="yes" />
<xsl:param as="xs:boolean" name="XSLT-SUPPORTS-3-0" required="yes" />

<!-- XQuery processor capabilities -->
<xsl:param as="xs:boolean" name="XQUERY-SUPPORTS-SCHEMA" required="yes" />
Expand Down Expand Up @@ -106,6 +107,14 @@
<xsl:text>Requires schema-aware XSLT processor</xsl:text>
</xsl:when>

<xsl:when
test="
($test-type eq 't')
and (xs:decimal(../@xslt-version) eq 3.0)
and not($XSLT-SUPPORTS-3-0)">
<xsl:text>Requires XSLT 3.0 processor</xsl:text>
</xsl:when>

<xsl:when
test="
($test-type eq 'q')
Expand All @@ -129,6 +138,13 @@
and (x:saxon-version() lt x:pack-version(9, 9, 0, 0))">
<xsl:text>Requires Saxon bug #3838 to have been fixed</xsl:text>
</xsl:when>

<xsl:when
test="
($pis = 'require-saxon-bug-3889-fixed')
and (x:saxon-version() lt x:pack-version(9, 8, 0, 15))">
<xsl:text>Requires Saxon bug #3889 to have been fixed</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:variable>

Expand Down
3 changes: 2 additions & 1 deletion test/end-to-end/cases/mode-all.xspec
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<x:description stylesheet="mode-all.xsl" xmlns:x="http://www.jenitennison.com/xslt/xspec">
<x:description stylesheet="mode-all.xsl" xmlns:x="http://www.jenitennison.com/xslt/xspec"
xslt-version="3.0">

<!--
Test with mode="#all" template in the stylesheet being tested
Expand Down
75 changes: 45 additions & 30 deletions test/win-bats/collection.xml
Expand Up @@ -128,7 +128,7 @@
<case name="invoking xspec generates message with default report location and creates report files">
call :run ..\bin\xspec.bat ..\tutorial\escape-for-regex.xspec
call :verify_retval 0
call :verify_line 19 x "Report available at %PARENT_DIR_ABS%\tutorial\xspec\escape-for-regex-result.html"
call :verify_line 20 x "Report available at %PARENT_DIR_ABS%\tutorial\xspec\escape-for-regex-result.html"

rem Verify
rem * XML report file is created
Expand Down Expand Up @@ -163,7 +163,7 @@
<case name="invoking xspec with -j option generates message with JUnit report location and creates report files">
call :run ..\bin\xspec.bat -j ..\tutorial\escape-for-regex.xspec
call :verify_retval 0
call :verify_line 20 x "Report available at %PARENT_DIR_ABS%\tutorial\xspec\escape-for-regex-junit.xml"
call :verify_line 21 x "Report available at %PARENT_DIR_ABS%\tutorial\xspec\escape-for-regex-junit.xml"

rem XML report file
call :verify_exist ..\tutorial\xspec\escape-for-regex-result.xml
Expand All @@ -186,13 +186,13 @@
set "TEST_DIR=%WORK_DIR%"
call :run ..\bin\xspec.bat ..\tutorial\escape-for-regex.xspec
call :verify_retval 0
call :verify_line 19 x "Report available at %TEST_DIR%\escape-for-regex-result.html"
call :verify_line 20 x "Report available at %TEST_DIR%\escape-for-regex-result.html"
</case>

<case name="invoking xspec that passes a non xs:boolean does not raise a warning #46">
call :run ..\bin\xspec.bat xspec-46.xspec
call :verify_retval 0
call :verify_line 4 r "Testing with"
call :verify_line 5 r "Testing with"
</case>

<case ifdef="XMLCALABASH_JAR" name="executing the Saxon XProc harness generates a report with UTF-8 encoding">
Expand All @@ -210,7 +210,7 @@

call :run ..\bin\xspec.bat "%SPECIAL_CHARS_DIR%\escape-for-regex.xspec"
call :verify_retval 0
call :verify_line 20 x "Report available at %EXPECTED_REPORT%"
call :verify_line 21 x "Report available at %EXPECTED_REPORT%"
call :verify_exist "%EXPECTED_REPORT%"
</case>

Expand All @@ -230,7 +230,7 @@
set SCHEMATRON_XSLT_COMPILE=schematron\schematron-param-001-step3.xsl
call :run ..\bin\xspec.bat -s schematron\schematron-param-001.xspec
call :verify_retval 0
call :verify_line 19 x "passed: 9 / pending: 0 / failed: 0 / total: 9"
call :verify_line 20 x "passed: 9 / pending: 0 / failed: 0 / total: 9"
</case>

<case name="Schematron phase/parameters are passed to Schematron compile (Ant)">
Expand All @@ -256,7 +256,7 @@
call :verify_line 4 x "I am schematron-xslt-include.xsl!"
call :verify_line 5 x "I am schematron-xslt-expand.xsl!"
call :verify_line 6 x "I am schematron-xslt-compile.xsl!"
call :verify_line 18 x "passed: 3 / pending: 0 / failed: 0 / total: 3"
call :verify_line 19 x "passed: 3 / pending: 0 / failed: 0 / total: 3"
</case>

<case name="invoking xspec with Schematron XSLTs provided externally uses provided XSLTs for Schematron compile (Ant)">
Expand Down Expand Up @@ -323,7 +323,7 @@
<case name="invoking xspec with -q option runs XSpec test for XQuery">
call :run ..\bin\xspec.bat -q ..\tutorial\xquery-tutorial.xspec
call :verify_retval 0
call :verify_line 5 x "passed: 1 / pending: 0 / failed: 0 / total: 1"
call :verify_line 6 x "passed: 1 / pending: 0 / failed: 0 / total: 1"
</case>

<case ifdef="BASEX_JAR XMLCALABASH_JAR" name="XProc harness for BaseX (standalone)">
Expand Down Expand Up @@ -368,8 +368,8 @@
-o result="file:/%EXPECTED_REPORT:\=/%" ^
..\src\harnesses\basex\basex-server-xquery-harness.xproc
call :verify_retval 0
call :verify_line_count 1
call :verify_line 1 r "..*/src/harnesses/harness-lib.xpl:267:45:passed: 1 / pending: 0 / failed: 0 / total: 1"
call :verify_line_count 2
call :verify_line 2 r "..*/src/harnesses/harness-lib.xpl:267:45:passed: 1 / pending: 0 / failed: 0 / total: 1"

rem Output file
call :verify_exist "%EXPECTED_REPORT%"
Expand Down Expand Up @@ -497,21 +497,21 @@
set "SAXON_CP=%SAXON_JAR%;%XML_RESOLVER_JAR%"
call :run ..\bin\xspec.bat -catalog "%SPACE_DIR%\catalog-01-catalog.xml" "%SPACE_DIR%\catalog-01-xslt.xspec"
call :verify_retval 0
call :verify_line 8 x "passed: 1 / pending: 0 / failed: 0 / total: 1"
call :verify_line 9 x "passed: 1 / pending: 0 / failed: 0 / total: 1"
</case>

<case ifdef="XML_RESOLVER_JAR" name="invoking xspec for XQuery with -catalog uses XML Catalog resolver">
set "SAXON_CP=%SAXON_JAR%;%XML_RESOLVER_JAR%"
call :run ..\bin\xspec.bat -catalog catalog\catalog-01-catalog.xml -q catalog\catalog-01-xquery.xspec
call :verify_retval 0
call :verify_line 5 x "passed: 1 / pending: 0 / failed: 0 / total: 1"
call :verify_line 6 x "passed: 1 / pending: 0 / failed: 0 / total: 1"
</case>

<case ifdef="XML_RESOLVER_JAR" name="invoking xspec for Schematron with -catalog uses XML Catalog resolver">
set "SAXON_CP=%SAXON_JAR%;%XML_RESOLVER_JAR%"
call :run ..\bin\xspec.bat -catalog catalog\catalog-02-catalog.xml -s catalog\catalog-02-schematron.xspec
call :verify_retval 0
call :verify_line 13 x "passed: 1 / pending: 0 / failed: 1 / total: 2"
call :verify_line 14 x "passed: 1 / pending: 0 / failed: 1 / total: 2"
</case>

<case ifdef="XML_RESOLVER_JAR" name="invoking xspec with XML_CATALOG set uses XML Catalog resolver and does so even with spaces in file path">
Expand All @@ -523,7 +523,7 @@
set "XML_CATALOG=%SPACE_DIR%\catalog-01-catalog.xml"
call :run ..\bin\xspec.bat "%SPACE_DIR%\catalog-01-xslt.xspec"
call :verify_retval 0
call :verify_line 8 x "passed: 1 / pending: 0 / failed: 0 / total: 1"
call :verify_line 9 x "passed: 1 / pending: 0 / failed: 0 / total: 1"
</case>

<case ifdef="XML_RESOLVER_JAR" name="invoking xspec using SAXON_HOME finds Saxon jar and XML Catalog Resolver jar">
Expand All @@ -539,7 +539,7 @@

call :run ..\bin\xspec.bat -catalog catalog\catalog-01-catalog.xml catalog\catalog-01-xslt.xspec
call :verify_retval 0
call :verify_line 8 x "passed: 1 / pending: 0 / failed: 0 / total: 1"
call :verify_line 9 x "passed: 1 / pending: 0 / failed: 0 / total: 1"
</case>

<case ifdef="JING_JAR" name="Schema detects no error in known good .xspec files">
Expand Down Expand Up @@ -674,15 +674,15 @@

call :run ..\bin\xspec.bat xspec-185\import-1.xspec
call :verify_retval 0
call :verify_line 5 x "Scenario 1-1"
call :verify_line 6 x "Scenario 1-2"
call :verify_line 7 x "Scenario 1-3"
call :verify_line 8 x "Scenario 2a-1"
call :verify_line 9 x "Scenario 2a-2"
call :verify_line 10 x "Scenario 2b-1"
call :verify_line 11 x "Scenario 2b-2"
call :verify_line 12 x "Scenario 3"
call :verify_line 13 x "Formatting Report..."
call :verify_line 6 x "Scenario 1-1"
call :verify_line 7 x "Scenario 1-2"
call :verify_line 8 x "Scenario 1-3"
call :verify_line 9 x "Scenario 2a-1"
call :verify_line 10 x "Scenario 2a-2"
call :verify_line 11 x "Scenario 2b-1"
call :verify_line 12 x "Scenario 2b-2"
call :verify_line 13 x "Scenario 3"
call :verify_line 14 x "Formatting Report..."
</case>

<case name="Import order with Ant #185">
Expand All @@ -707,10 +707,10 @@
rem Provide TEST_DIR with an existing directory to make the output lines predictable
set "TEST_DIR=%WORK_DIR%"
call :run ..\bin\xspec.bat end-to-end\cases\xspec-ambiguous-expect.xspec
call :verify_line 10 r "WARNING: x:expect has boolean @test"
call :verify_line 15 r "WARNING: x:expect has boolean @test"
call :verify_line 22 r "WARNING: x:expect has boolean @test"
call :verify_line 31 x "Formatting Report..."
call :verify_line 11 r "WARNING: x:expect has boolean @test"
call :verify_line 16 r "WARNING: x:expect has boolean @test"
call :verify_line 23 r "WARNING: x:expect has boolean @test"
call :verify_line 32 x "Formatting Report..."
</case>

<case name="Deprecate x:space">
Expand Down Expand Up @@ -804,7 +804,7 @@
<case name="Error message when source is not XSpec #522">
call :run ..\bin\xspec.bat do-nothing.xsl
call :verify_retval 2
call :verify_line 3 r "Source document is not XSpec"
call :verify_line 4 r "Source document is not XSpec"
</case>

<case name="Error on user-defined variable in XSpec namespace">
Expand All @@ -813,6 +813,21 @@

call :run ..\bin\xspec.bat variable\reserved-name.xspec
call :verify_retval 2
call :verify_line 4 r ".*x:XSPEC008:"
call :verify_line 5 r ".*x:XSPEC008:"
</case>

<case name="Deprecated Saxon version">
rem Make the line numbers predictable by providing an existing output dir
set "TEST_DIR=%WORK_DIR%"

call :run ..\bin\xspec.bat ..\tutorial\escape-for-regex.xspec
call :verify_retval 0

java -cp "%SAXON_JAR%" net.sf.saxon.Version 2>&amp;1 | find " 9.7."
if errorlevel 1 (
call :verify_line 3 x " "
) else (
call :verify_line 3 r "WARNING: Saxon version ..*"
)
</case>
</collection>
1 change: 1 addition & 0 deletions test/xspec-no-prefix_stylesheet.xspec
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xspec-test require-saxon-bug-3889-fixed?>
<!-- Copy of xspec-eqname_stylesheet.xspec with x: prefix removed -->
<description stylesheet="xspec-eqname.xsl" xmlns="http://www.jenitennison.com/xslt/xspec"
xslt-version="3.0">
Expand Down