Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/xspec/xspec into fix_issue-67
Browse files Browse the repository at this point in the history
* 'master' of git://github.com/xspec/xspec:
  Separate common tests (for XSLT and XQuery) from generate-tests-utils.xspec (only for XSLT)  (#83)
  Make XProc testing command lines more portable (xspec#98)
  Update Saxon versions (xspec#116)
  Display result.log on test failure (xspec#110)

# Conflicts:
#	test/generate-tests-utils.xspec
  • Loading branch information
AirQuick committed Apr 9, 2017
2 parents 15bda13 + 120b331 commit abb719c
Show file tree
Hide file tree
Showing 7 changed files with 164 additions and 111 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
@@ -1,12 +1,12 @@
env:
matrix:
# latest Saxon 9.7 version
- SAXON_VERSION=9.7.0-15
XMLCALABASH_VERSION=1.1.15-97
- SAXON_VERSION=9.7.0-18
XMLCALABASH_VERSION=1.1.15-97
# latest Saxon 9.6 version
- SAXON_VERSION=9.6.0-10
# Saxon version used in oXygen
- SAXON_VERSION=9.6.0-7
- SAXON_VERSION=9.7.0-15

before_script:
# install bats
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Expand Up @@ -2,12 +2,12 @@ environment:
SAXON_CP: '%TEMP%\xspec\saxon\saxon9he.jar'
matrix:
# latest Saxon 9.7 version
- SAXON_VERSION: 9.7.0-15
- SAXON_VERSION: 9.7.0-18
XMLCALABASH_VERSION: 1.1.15-97
# latest Saxon 9.6 version
- SAXON_VERSION: 9.6.0-10
# Saxon version used in oXygen
- SAXON_VERSION: 9.6.0-7
- SAXON_VERSION: 9.7.0-15

install:
- ps: >-
Expand Down
109 changes: 8 additions & 101 deletions test/generate-tests-utils.xspec
@@ -1,77 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================== -->
<!-- File: test/generate-tests-utils.xspec -->
<!-- Author: Florent Georges -->
<!-- Tags: -->
<!-- Copyright (c) 2010 Jeni Tennsion (see end of file.) -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<t:description xmlns:t="http://www.jenitennison.com/xslt/xspec" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:test="http://www.jenitennison.com/xslt/unit-test" query="http://www.jenitennison.com/xslt/unit-test" query-at="../src/compiler/generate-query-utils.xql" stylesheet="generate-tests-utils.xsl">
<t:description xmlns:t="http://www.jenitennison.com/xslt/xspec" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:test="http://www.jenitennison.com/xslt/unit-test" stylesheet="generate-tests-utils.xsl">
<!--
Test the source files generate-tests-utils.xsl and generate-query-utils.xql.
Test the source file generate-tests-utils.xsl.
-->
<!--
Function test:deep-equal($seq1, $seq2).
-->
<t:scenario label="test:deep-equal($seq1, $seq2)">
<t:scenario label="Identical Sequences">
<t:call function="test:deep-equal">
<t:param select="1, 2"/>
<t:param select="1, 2"/>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
</t:scenario>
<t:scenario label="Non-Identical Sequences">
<t:call function="test:deep-equal">
<t:param select="1, 2"/>
<t:param select="1, 3"/>
</t:call>
<t:expect label="the result" test="$x:result eq false()"/>
</t:scenario>
<t:scenario label="Sequences with Same Items in Different Orders">
<t:call function="test:deep-equal">
<t:param select="1, 2"/>
<t:param select="2, 1"/>
</t:call>
<t:expect label="the result" test="$x:result eq false()"/>
</t:scenario>
<t:scenario label="Empty Sequences">
<t:call function="test:deep-equal">
<t:param select="()"/>
<t:param select="()"/>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
</t:scenario>
<t:scenario label="One empty sequence">
<t:call function="test:deep-equal">
<t:param select="()"/>
<t:param select="1"/>
</t:call>
<t:expect label="the result" test="$x:result eq false()"/>
</t:scenario>
<t:scenario label="A text node and several text nodes">
<t:variable name="elems" as="element()+">
<e>foo</e>
<e>bar</e>
</t:variable>
<t:call function="test:deep-equal">
<t:param as="text()">foobar</t:param>
<t:param select="$elems/text()"/>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
</t:scenario>
</t:scenario>
<!--
Function test:node-deep-equal($seq1, $seq2).
-->
<t:scenario label="test:node-deep-equal($seq1, $seq2)">
<t:scenario label="Identical Element Sequences">
<t:call function="test:node-deep-equal">
<t:param name="node1">foobar</t:param>
<t:param name="node2">foobar</t:param>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
</t:scenario>
<t:scenario label="Identical Attribute Sequences">
<!-- TODO: This scenario does not run on XQuery: xspec/xspec#82 -->
<t:call function="test:node-deep-equal">
<t:param name="node1" select="/node/@attribute" as="node()">
<node attribute="foobar"/>
Expand Down Expand Up @@ -274,14 +211,8 @@
-->
<t:scenario label="test:report-atomic-value">

<t:scenario label="Copy of https://github.com/xspec/xspec/blob/8931b371bd619feeeee25bd7014d8a677ab88505/src/compiler/generate-tests-utils.xsl#L622-L629">
<t:scenario label="String Containing Single Quotes">
<t:call function="test:report-atomic-value">
<t:param select="'don''t'" />
</t:call>
<t:expect label="Escaped" select="'''don''''t'''" />
</t:scenario>
</t:scenario>
<!-- TODO: Many of these scenarios fail on XQuery
xspec/xspec#58 has not been implemented for XQuery -->

<t:scenario label="xs:integer">
<t:scenario label="Max of xs:unsignedLong (a subtype of xs:integer)">
Expand Down Expand Up @@ -436,6 +367,9 @@
-->
<t:scenario label="test:atom-type">

<!-- TODO: Most of these scenarios fail on XQuery
xspec/xspec#58 has not been implemented for XQuery -->

<t:scenario label="All the primitive atomic types defined in [XML Schema Part 2], with the exception of xs:NOTATION">

<t:scenario label="xs:string">
Expand Down Expand Up @@ -685,30 +619,3 @@
</t:scenario>

</t:description>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. -->
<!-- -->
<!-- Copyright (c) 2010 Jeni Tennsion -->
<!-- -->
<!-- The contents of this file are subject to the MIT License (see the URI -->
<!-- http://www.opensource.org/licenses/mit-license.php for details). -->
<!-- -->
<!-- Permission is hereby granted, free of charge, to any person obtaining -->
<!-- a copy of this software and associated documentation files (the -->
<!-- "Software"), to deal in the Software without restriction, including -->
<!-- without limitation the rights to use, copy, modify, merge, publish, -->
<!-- distribute, sublicense, and/or sell copies of the Software, and to -->
<!-- permit persons to whom the Software is furnished to do so, subject to -->
<!-- the following conditions: -->
<!-- -->
<!-- The above copyright notice and this permission notice shall be -->
<!-- included in all copies or substantial portions of the Software. -->
<!-- -->
<!-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -->
<!-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -->
<!-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.-->
<!-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -->
<!-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -->
<!-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -->
<!-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
138 changes: 138 additions & 0 deletions test/generate-x-utils.xspec
@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================== -->
<!-- File: test/generate-x-utils.xspec -->
<!-- Author: Florent Georges -->
<!-- Tags: -->
<!-- Copyright (c) 2010 Jeni Tennsion (see end of file.) -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<t:description xmlns:t="http://www.jenitennison.com/xslt/xspec"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:test="http://www.jenitennison.com/xslt/unit-test"
query="http://www.jenitennison.com/xslt/unit-test"
query-at="../src/compiler/generate-query-utils.xql"
stylesheet="../src/compiler/generate-tests-utils.xsl">

<!--
Test the source files generate-tests-utils.xsl and generate-query-utils.xql.
-->

<!--
Function test:deep-equal($seq1, $seq2).
-->
<t:scenario label="test:deep-equal($seq1, $seq2)">

<t:scenario label="Identical Sequences">
<t:call function="test:deep-equal">
<t:param select="1, 2"/>
<t:param select="1, 2"/>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
</t:scenario>

<t:scenario label="Non-Identical Sequences">
<t:call function="test:deep-equal">
<t:param select="1, 2"/>
<t:param select="1, 3"/>
</t:call>
<t:expect label="the result" test="$x:result eq false()"/>
</t:scenario>

<t:scenario label="Sequences with Same Items in Different Orders">
<t:call function="test:deep-equal">
<t:param select="1, 2"/>
<t:param select="2, 1"/>
</t:call>
<t:expect label="the result" test="$x:result eq false()"/>
</t:scenario>

<t:scenario label="Empty Sequences">
<t:call function="test:deep-equal">
<t:param select="()"/>
<t:param select="()"/>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
</t:scenario>

<t:scenario label="One empty sequence">
<t:call function="test:deep-equal">
<t:param select="()"/>
<t:param select="1"/>
</t:call>
<t:expect label="the result" test="$x:result eq false()"/>
</t:scenario>

<t:scenario label="A text node and several text nodes">
<t:variable name="elems" as="element()+">
<e>foo</e>
<e>bar</e>
</t:variable>
<t:call function="test:deep-equal">
<t:param as="text()">foobar</t:param>
<t:param select="$elems/text()"/>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
</t:scenario>

</t:scenario>

<!--
Function test:node-deep-equal($seq1, $seq2).
-->
<t:scenario label="test:node-deep-equal($seq1, $seq2)">

<t:scenario label="Identical Element Sequences">
<t:call function="test:node-deep-equal">
<t:param name="node1">foobar</t:param>
<t:param name="node2">foobar</t:param>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
</t:scenario>

</t:scenario>

<!--
Function test:report-atomic-value
-->
<t:scenario label="test:report-atomic-value">

<t:scenario label="Copy of https://github.com/xspec/xspec/blob/8931b371bd619feeeee25bd7014d8a677ab88505/src/compiler/generate-tests-utils.xsl#L622-L629">
<t:scenario label="String Containing Single Quotes">
<t:call function="test:report-atomic-value">
<t:param select="'don''t'" />
</t:call>
<t:expect label="Escaped" select="'''don''''t'''" />
</t:scenario>
</t:scenario>

</t:scenario>

</t:description>


<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. -->
<!-- -->
<!-- Copyright (c) 2010 Jeni Tennsion -->
<!-- -->
<!-- The contents of this file are subject to the MIT License (see the URI -->
<!-- http://www.opensource.org/licenses/mit-license.php for details). -->
<!-- -->
<!-- Permission is hereby granted, free of charge, to any person obtaining -->
<!-- a copy of this software and associated documentation files (the -->
<!-- "Software"), to deal in the Software without restriction, including -->
<!-- without limitation the rights to use, copy, modify, merge, publish, -->
<!-- distribute, sublicense, and/or sell copies of the Software, and to -->
<!-- permit persons to whom the Software is furnished to do so, subject to -->
<!-- the following conditions: -->
<!-- -->
<!-- The above copyright notice and this permission notice shall be -->
<!-- included in all copies or substantial portions of the Software. -->
<!-- -->
<!-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -->
<!-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -->
<!-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.-->
<!-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -->
<!-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -->
<!-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -->
<!-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
5 changes: 4 additions & 1 deletion test/run-xspec-tests.cmd
Expand Up @@ -44,9 +44,12 @@ for %%I in (*.xspec) do (
rem
rem Inspect result
rem
findstr /r /c:".*failed: [1-9]" "%RESULT_FILE%" || findstr /r /c:"\*\** Error [a-z][a-z]*ing the test suite" "%RESULT_FILE%"
( findstr /r /c:".*failed: [1-9]" "%RESULT_FILE%" || findstr /r /c:"\*\** Error [a-z][a-z]*ing the test suite" "%RESULT_FILE%" ) > NUL
if not errorlevel 1 (
echo FAILED: %%~I
echo ---------- "%RESULT_FILE%"
type "%RESULT_FILE%"
echo ----------
if /i "%APPVEYOR%"=="True" appveyor UpdateTest "%%~I" -Framework custom -Filename "%~nx0" -Outcome Failed -Duration 0
exit /b 1
) else (
Expand Down
7 changes: 6 additions & 1 deletion test/run-xspec-tests.sh
Expand Up @@ -26,7 +26,12 @@
for xspectest in *.xspec;
do ../bin/xspec.sh $xspectest &> result.log;
if grep -q ".*failed:\s[1-9]" result.log || grep -q -E "\*+\sError\s(running|compiling)\sthe\stest\ssuite" result.log;
then echo "FAILED: $xspectest" && exit 1;
then
echo "FAILED: $xspectest";
echo "---------- result.log";
cat result.log;
echo "----------";
exit 1;
else echo "OK: $xspectest";
fi
done
6 changes: 3 additions & 3 deletions test/xspec.bats
Expand Up @@ -197,11 +197,11 @@ teardown() {
if [ -z ${XMLCALABASH_CP} ]; then
skip "test for XProc skipped as XMLCalabash uses a higher version of Saxon";
else
run java -Xmx1024m -cp ${XMLCALABASH_CP} com.xmlcalabash.drivers.Main -isource=xspec-72.xspec -p xspec-home=file://${TRAVIS_BUILD_DIR}/ -oresult=${TRAVIS_BUILD_DIR}/test/xspec/xspec-72-result.html ${TRAVIS_BUILD_DIR}/src/harnesses/saxon/saxon-xslt-harness.xproc
run java -Xmx1024m -cp ${XMLCALABASH_CP} com.xmlcalabash.drivers.Main -isource=xspec-72.xspec -p xspec-home=file:${PWD}/../ -oresult=xspec/xspec-72-result.html ../src/harnesses/saxon/saxon-xslt-harness.xproc

query="declare default element namespace 'http://www.w3.org/1999/xhtml'; /html/head/meta[@http-equiv eq 'Content-Type']/@content = 'text/html; charset=UTF-8'";
query="declare default element namespace 'http://www.w3.org/1999/xhtml'; concat(/html/head/meta[@http-equiv eq 'Content-Type']/@content = 'text/html; charset=UTF-8', '&#x0A;')";

run java -cp ${SAXON_CP} net.sf.saxon.Query -s:${TRAVIS_BUILD_DIR}/test/xspec/xspec-72-result.html -qs:"$query" !method=text
run java -cp ${SAXON_CP} net.sf.saxon.Query -s:xspec/xspec-72-result.html -qs:"$query" !method=text
fi

echo $output
Expand Down

0 comments on commit abb719c

Please sign in to comment.