Skip to content

Commit

Permalink
Align Travis configuration with AppVeyor in #86 (#96)
Browse files Browse the repository at this point in the history
* align Travis configuration with AppVeyor in #86
  • Loading branch information
Sandro Cirulli committed Mar 7, 2017
1 parent ef2d44c commit f4811a5
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 32 deletions.
12 changes: 8 additions & 4 deletions .travis.yml
Expand Up @@ -2,6 +2,7 @@ env:
matrix:
# latest Saxon 9.7 version
- SAXON_VERSION=9.7.0-15
XMLCALABASH_VERSION=1.1.15-97
# latest Saxon 9.6 version
- SAXON_VERSION=9.6.0-10
# Saxon version used in oXygen
Expand All @@ -19,10 +20,13 @@ before_script:
- wget -O ${SAXON_CP} http://central.maven.org/maven2/net/sf/saxon/Saxon-HE/${SAXON_VERSION}/Saxon-HE-${SAXON_VERSION}.jar
- chmod +x ${SAXON_CP}
# install XML Calabash
- export XMLCALABASH_VERSION=1.1.15-97
- wget -O /tmp/xspec/xmlcalabash-${XMLCALABASH_VERSION}.zip https://github.com/ndw/xmlcalabash1/releases/download/${XMLCALABASH_VERSION}/xmlcalabash-${XMLCALABASH_VERSION}.zip
- unzip /tmp/xspec/xmlcalabash-${XMLCALABASH_VERSION}.zip -d /tmp/xspec
- export XMLCALABASH_CP=/tmp/xspec/xmlcalabash-${XMLCALABASH_VERSION}/xmlcalabash-${XMLCALABASH_VERSION}.jar
- if [ -z ${XMLCALABASH_VERSION} ]; then
echo "XMLCalabash will not be installed as it uses a higher version of Saxon";
else
wget -O /tmp/xspec/xmlcalabash-${XMLCALABASH_VERSION}.zip https://github.com/ndw/xmlcalabash1/releases/download/${XMLCALABASH_VERSION}/xmlcalabash-${XMLCALABASH_VERSION}.zip;
unzip /tmp/xspec/xmlcalabash-${XMLCALABASH_VERSION}.zip -d /tmp/xspec;
export XMLCALABASH_CP=/tmp/xspec/xmlcalabash-${XMLCALABASH_VERSION}/xmlcalabash-${XMLCALABASH_VERSION}.jar;
fi

script:
- cd test
Expand Down
60 changes: 32 additions & 28 deletions test/xspec.bats
Expand Up @@ -18,20 +18,20 @@
#===============================================================================

setup() {
mkdir ../tutorial/xspec
mkdir ../test/xspec
mkdir ../tutorial/xspec
mkdir ../test/xspec
}


teardown() {
rm -rf ../tutorial/xspec
rm -rf ../test/xspec
rm -rf ../tutorial/xspec
rm -rf ../test/xspec
}


@test "invoking xspec without arguments prints usage" {
run ../bin/xspec.sh
echo $output
echo $output
[ "$status" -eq 1 ]
[ "${lines[2]}" = "Usage: xspec [-t|-q|-c|-j|-h] filename [coverage]" ]
}
Expand All @@ -40,7 +40,7 @@ teardown() {
@test "invoking code coverage with Saxon9HE returns error message" {
export SAXON_CP=/path/to/saxon9he.jar
run ../bin/xspec.sh -c ../tutorial/escape-for-regex.xspec
echo $output
echo $output
[ "$status" -eq 1 ]
[ "${lines[1]}" = "Code coverage requires Saxon extension functions which are available only under Saxon9EE or Saxon9PE." ]
}
Expand All @@ -49,7 +49,7 @@ teardown() {
@test "invoking code coverage with Saxon9SA returns error message" {
export SAXON_CP=/path/to/saxon9sa.jar
run ../bin/xspec.sh -c ../tutorial/escape-for-regex.xspec
echo $output
echo $output
[ "$status" -eq 1 ]
[ "${lines[1]}" = "Code coverage requires Saxon extension functions which are available only under Saxon9EE or Saxon9PE." ]
}
Expand All @@ -58,7 +58,7 @@ teardown() {
@test "invoking code coverage with Saxon9 returns error message" {
export SAXON_CP=/path/to/saxon9.jar
run ../bin/xspec.sh -c ../tutorial/escape-for-regex.xspec
echo $output
echo $output
[ "$status" -eq 1 ]
[ "${lines[1]}" = "Code coverage requires Saxon extension functions which are available only under Saxon9EE or Saxon9PE." ]
}
Expand All @@ -67,7 +67,7 @@ teardown() {
@test "invoking code coverage with Saxon8SA returns error message" {
export SAXON_CP=/path/to/saxon8sa.jar
run ../bin/xspec.sh -c ../tutorial/escape-for-regex.xspec
echo $output
echo $output
[ "$status" -eq 1 ]
[ "${lines[1]}" = "Code coverage requires Saxon extension functions which are available only under Saxon9EE or Saxon9PE." ]
}
Expand All @@ -76,7 +76,7 @@ teardown() {
@test "invoking code coverage with Saxon8 returns error message" {
export SAXON_CP=/path/to/saxon8.jar
run ../bin/xspec.sh -c ../tutorial/escape-for-regex.xspec
echo $output
echo $output
[ "$status" -eq 1 ]
[ "${lines[1]}" = "Code coverage requires Saxon extension functions which are available only under Saxon9EE or Saxon9PE." ]
}
Expand All @@ -94,7 +94,7 @@ teardown() {
@test "invoking code coverage with Saxon9PE creates test stylesheet" {
export SAXON_CP=/path/to/saxon9pe.jar
run ../bin/xspec.sh -c ../tutorial/escape-for-regex.xspec
echo $output
echo $output
[ "$status" -eq 1 ]
[ "${lines[1]}" = "Creating Test Stylesheet..." ]
}
Expand All @@ -103,23 +103,23 @@ teardown() {
@test "invoking xspec generates XML report file" {
run ../bin/xspec.sh ../tutorial/escape-for-regex.xspec
run stat ../tutorial/xspec/escape-for-regex-result.xml
echo $output
echo $output
[ "$status" -eq 0 ]
}


@test "invoking xspec generates HTML report file" {
run ../bin/xspec.sh ../tutorial/escape-for-regex.xspec
run stat ../tutorial/xspec/escape-for-regex-result.html
echo $output
echo $output
[ "$status" -eq 0 ]
}


@test "invoking xspec with -j option with Saxon8 returns error message" {
export SAXON_CP=/path/to/saxon8.jar
run ../bin/xspec.sh -j ../tutorial/escape-for-regex.xspec
echo $output
echo $output
[ "$status" -eq 1 ]
[ "${lines[1]}" = "Saxon8 detected. JUnit report requires Saxon9." ]
}
Expand All @@ -128,15 +128,15 @@ teardown() {
@test "invoking xspec with -j option with Saxon8-SA returns error message" {
export SAXON_CP=/path/to/saxon8sa.jar
run ../bin/xspec.sh -j ../tutorial/escape-for-regex.xspec
echo $output
echo $output
[ "$status" -eq 1 ]
[ "${lines[1]}" = "Saxon8 detected. JUnit report requires Saxon9." ]
}


@test "invoking xspec with -j option generates message with JUnit report location" {
run ../bin/xspec.sh -j ../tutorial/escape-for-regex.xspec
echo $output
echo $output
[ "$status" -eq 0 ]
[ "${lines[18]}" = "Report available at ../tutorial/xspec/escape-for-regex-junit.xml" ]
}
Expand All @@ -145,56 +145,60 @@ teardown() {
@test "invoking xspec with -j option generates XML report file" {
run ../bin/xspec.sh -j ../tutorial/escape-for-regex.xspec
run stat ../tutorial/xspec/escape-for-regex-result.xml
echo $output
echo $output
[ "$status" -eq 0 ]
}


@test "invoking xspec with -j option generates JUnit report file" {
run ../bin/xspec.sh -j ../tutorial/escape-for-regex.xspec
run stat ../tutorial/xspec/escape-for-regex-junit.xml
echo $output
echo $output
[ "$status" -eq 0 ]
}


@test "invoking xspec with Saxon-B-9-1-0-8 creates test stylesheet" {
export SAXON_CP=/path/to/saxonb9-1-0-8.jar
run ../bin/xspec.sh ../tutorial/escape-for-regex.xspec
echo $output
[ "$status" -eq 1 ]
run ../bin/xspec.sh ../tutorial/escape-for-regex.xspec
echo $output
[ "$status" -eq 1 ]
[ "${lines[1]}" = "Creating Test Stylesheet..." ]
}


@test "invoking xspec.sh with TEST_DIR already set externally generates files inside TEST_DIR" {
export TEST_DIR=/tmp
run ../bin/xspec.sh ../tutorial/escape-for-regex.xspec
echo $output
echo $output
[ "$status" -eq 0 ]
[ "${lines[18]}" = "Report available at /tmp/escape-for-regex-result.html" ]
}


@test "invoking xspec.sh without TEST_DIR generates files in default location" {
run ../bin/xspec.sh ../tutorial/escape-for-regex.xspec
echo $output
echo $output
[ "$status" -eq 0 ]
[ "${lines[18]}" = "Report available at ../tutorial/xspec/escape-for-regex-result.html" ]
}


@test "invoking xspec.sh that passes a non xs:boolean does not raise a warning #46" {
run ../bin/xspec.sh ../test/xspec-46.xspec
echo $output
echo $output
[ "$status" -eq 0 ]
[[ "${lines[3]}" =~ "Testing with" ]]
}


@test "executing the Saxon XProc harness generates a report with UTF-8 encoding" {
run java -Xmx1024m -cp ${XMLCALABASH_CP} com.xmlcalabash.drivers.Main -isource=xspec-72.xspec xspec-home=file:${PWD}/../ -oresult=xspec/xspec-72-result.html ../src/harnesses/saxon/saxon-xslt-harness.xproc
run java -cp ${SAXON_CP} net.sf.saxon.Query -s:xspec/xspec-72-result.html -qs:"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', '
')" !method=text
echo $output
if [ -z ${XMLCALABASH_CP} ]; then
skip "test for XProc skipped as XMLCalabash uses a higher version of Saxon";
fi

run java -Xmx1024m -cp ${XMLCALABASH_CP} com.xmlcalabash.drivers.Main -isource=xspec-72.xspec 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 -cp ${SAXON_CP} net.sf.saxon.Query -s:${TRAVIS_BUILD_DIR}/test/xspec/xspec-72-result.html -qs:"declare default element namespace 'http://www.w3.org/1999/xhtml'; /html/head/meta[@http-equiv eq 'Content-Type']/@content = 'text/html; charset=UTF-8'" !method=text
echo $output
[[ "${lines[0]}" = 'true' ]]
}
}

0 comments on commit f4811a5

Please sign in to comment.