diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..48de22d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,44 @@ +language: generic +env: + global: + # XSpec version + - XSPEC_VERSION=1.0.0 + #- XSPEC_HOME=/tmp/schematron/xspec/ + # full path to Saxon jar + - SAXON_CP=/tmp/schematron/saxon/saxon9he.jar + # Ant version used in oXygen + - ANT_VERSION=1.9.8 + # full path to XML Resolver jar + - XML_RESOLVER_CP=/tmp/schematron/xml-resolver/resolver.jar + matrix: + # latest Saxon 9.8 version and full path to Jing jar + - SAXON_VERSION=9.8.0-7 + JING_CP=/tmp/schematron/jing/jing.jar + +before_install: + - unset _JAVA_OPTIONS + +before_script: + # install XSpec + - curl -fsSL --create-dirs -o /tmp/schematron/xspec/xspec.zip https://github.com/xspec/xspec/archive/v${XSPEC_VERSION}.zip; + - unzip /tmp/schematron/xspec/xspec.zip -d /tmp/schematron/xspec; + - export XSPEC_HOME=/tmp/schematron/xspec/xspec-${XSPEC_VERSION}; + # install Saxon + - curl -fsSL --create-dirs -o ${SAXON_CP} http://central.maven.org/maven2/net/sf/saxon/Saxon-HE/${SAXON_VERSION}/Saxon-HE-${SAXON_VERSION}.jar + # install Ant + - curl -fsSL --create-dirs -o /tmp/schematron/ant/ant.tar.gz http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz + - tar xf /tmp/schematron/ant/ant.tar.gz -C /tmp/schematron/ant; + - export PATH=/tmp/schematron/ant/apache-ant-${ANT_VERSION}/bin:{$PATH} + # install XML Resolver + - curl -fsSL --create-dirs -o ${XML_RESOLVER_CP} http://central.maven.org/maven2/xml-resolver/xml-resolver/1.2/xml-resolver-1.2.jar + +script: + - ant -version + #- cd trunk/schematron/test + #- ant -Dsaxon.jar=${SAXON_CP} -Dxspec.project.dir=${XSPEC_HOME} + #- ${XSPEC_HOME}/bin/xspec.sh -s schematron/universalTests.xspec + #- ${XSPEC_HOME}/bin/xspec.sh -s schematron/universalTests-xslt2.xspec + #- echo "Run XSpec from shell script" + #- ./run-xspec.sh + - echo "execute bats unit tests" + - bats --tap schematron.bats diff --git a/let/let-scope-01.sch b/let/let-scope-01.sch new file mode 100644 index 0000000..b045c2b --- /dev/null +++ b/let/let-scope-01.sch @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/let/let-scope-01.xspec b/let/let-scope-01.xspec new file mode 100644 index 0000000..66b964d --- /dev/null +++ b/let/let-scope-01.xspec @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/name/svrl-name-01.sch b/name/svrl-name-01.sch new file mode 100644 index 0000000..5132e27 --- /dev/null +++ b/name/svrl-name-01.sch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/name/svrl-name-01.xspec b/name/svrl-name-01.xspec new file mode 100644 index 0000000..ec35f7c --- /dev/null +++ b/name/svrl-name-01.xspec @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/phase/phase-01.sch b/phase/phase-01.sch new file mode 100644 index 0000000..ea179ad --- /dev/null +++ b/phase/phase-01.sch @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/phase/phase-01.xspec b/phase/phase-01.xspec new file mode 100644 index 0000000..11e8312 --- /dev/null +++ b/phase/phase-01.xspec @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/phase/phase-02.sch b/phase/phase-02.sch new file mode 100644 index 0000000..10fe74a --- /dev/null +++ b/phase/phase-02.sch @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/phase/phase-02.xspec b/phase/phase-02.xspec new file mode 100644 index 0000000..4038381 --- /dev/null +++ b/phase/phase-02.xspec @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/phase/phase-03.sch b/phase/phase-03.sch new file mode 100644 index 0000000..8fdf366 --- /dev/null +++ b/phase/phase-03.sch @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/phase/phase-03.xspec b/phase/phase-03.xspec new file mode 100644 index 0000000..4d381dd --- /dev/null +++ b/phase/phase-03.xspec @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/phase/phase-04.sch b/phase/phase-04.sch new file mode 100644 index 0000000..75fcb52 --- /dev/null +++ b/phase/phase-04.sch @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/phase/phase-04.xspec b/phase/phase-04.xspec new file mode 100644 index 0000000..3f3bf5a --- /dev/null +++ b/phase/phase-04.xspec @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/rule/rule-context-01.sch b/rule/rule-context-01.sch new file mode 100644 index 0000000..e330cb7 --- /dev/null +++ b/rule/rule-context-01.sch @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/rule/rule-context-01.xspec b/rule/rule-context-01.xspec new file mode 100644 index 0000000..440a378 --- /dev/null +++ b/rule/rule-context-01.xspec @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + text + + + + diff --git a/rule/rule-order-01.sch b/rule/rule-order-01.sch new file mode 100644 index 0000000..32f62c7 --- /dev/null +++ b/rule/rule-order-01.sch @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/rule/rule-order-01.xspec b/rule/rule-order-01.xspec new file mode 100644 index 0000000..04c77c8 --- /dev/null +++ b/rule/rule-order-01.xspec @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/run-xspec.sh b/run-xspec.sh new file mode 100644 index 0000000..9aeaac7 --- /dev/null +++ b/run-xspec.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +${XSPEC_HOME}/bin/xspec.sh -s schematron/universalTests.xspec +${XSPEC_HOME}/bin/xspec.sh -s schematron/universalTests-xslt2.xspec diff --git a/schematron.bats b/schematron.bats new file mode 100644 index 0000000..edaf9af --- /dev/null +++ b/schematron.bats @@ -0,0 +1,119 @@ +#!/usr/bin/env bats +#=============================================================================== +# +# USAGE: bats schematron.bats +# +# DESCRIPTION: Unit tests for 'Schematron/schematron-test' project +# +# INPUT: N/A +# +# OUTPUT: Unit tests results +# +# DEPENDENCIES: This script requires bats (https://github.com/sstephenson/bats) +# +# AUTHOR: Tony Graham +# Blatantly copied from 'XSpec/xspec' +# +# LICENSE: MIT License (https://opensource.org/licenses/MIT) +# See 'LICENSE' in this directory +# +#=============================================================================== + +#setup() { +# BLAH="blah" +#} + + +#teardown() { +# BLAH="blah" +#} + +@test "schematron/universalTests.xspec" { + run ${XSPEC_HOME}/bin/xspec.sh -s schematron/universalTests.xspec + echo "$output" + [ "$status" -eq 0 ] + [[ "${output}" =~ "failed: 0" ]] + [[ "${output}" =~ "Done." ]] +} + +@test "schematron/universalTests-xslt2.xspec" { + run ${XSPEC_HOME}/bin/xspec.sh -s schematron/universalTests-xslt2.xspec + echo "$output" + [ "$status" -eq 0 ] + [[ "${output}" =~ "failed: 0" ]] + [[ "${output}" =~ "Done." ]] +} + +@test "value-of/svrl-value-of-01.xspec" { + run ${XSPEC_HOME}/bin/xspec.sh -s value-of/svrl-value-of-01.xspec + echo "$output" + [ "$status" -eq 0 ] + [[ "${output}" =~ "failed: 0" ]] + [[ "${output}" =~ "Done." ]] +} + +@test "name/svrl-name-01.xspec" { + run ${XSPEC_HOME}/bin/xspec.sh -s name/svrl-name-01.xspec + echo "$output" + [ "$status" -eq 0 ] + [[ "${output}" =~ "failed: 0" ]] + [[ "${output}" =~ "Done." ]] + +} + +@test "rule/rule-order-01.xspec" { + run ${XSPEC_HOME}/bin/xspec.sh -s rule/rule-order-01.xspec + echo "$output" + [ "$status" -eq 0 ] + [[ "${output}" =~ "failed: 0" ]] + [[ "${output}" =~ "Done." ]] + +} + +@test "rule/rule-context-01.xspec" { + run ${XSPEC_HOME}/bin/xspec.sh -s rule/rule-context-01.xspec + echo "$output" + [ "$status" -eq 0 ] + [[ "${output}" =~ "failed: 0" ]] + [[ "${output}" =~ "Done." ]] +} + +@test "phase/phase-03.xspec" { + run ${XSPEC_HOME}/bin/xspec.sh -s phase/phase-03.xspec + echo "$output" + [ "$status" -eq 0 ] + [[ "${output}" =~ "failed: 0" ]] + [[ "${output}" =~ "Done." ]] +} + +@test "phase/phase-04.xspec" { + run ${XSPEC_HOME}/bin/xspec.sh -s phase/phase-04.xspec + echo "$output" + [ "$status" -eq 0 ] + [[ "${output}" =~ "failed: 0" ]] + [[ "${output}" =~ "Done." ]] +} + +@test "phase/phase-01.xspec" { + run ${XSPEC_HOME}/bin/xspec.sh -s phase/phase-01.xspec + echo "$output" + [ "$status" -eq 0 ] + [[ "${output}" =~ "failed: 0" ]] + [[ "${output}" =~ "Done." ]] +} + +@test "phase/phase-02.xspec" { + run ${XSPEC_HOME}/bin/xspec.sh -s phase/phase-02.xspec + echo "$output" + [ "$status" -eq 0 ] + [[ "${output}" =~ "failed: 0" ]] + [[ "${output}" =~ "Done." ]] +} + +@test "let/let-scope-01.xspec" { + run ${XSPEC_HOME}/bin/xspec.sh -s let/let-scope-01.xspec + echo "$output" + [ "$status" -eq 0 ] + [[ "${output}" =~ "failed: 0" ]] + [[ "${output}" =~ "Done." ]] +} diff --git a/value-of/svrl-value-of-01.sch b/value-of/svrl-value-of-01.sch new file mode 100644 index 0000000..6632102 --- /dev/null +++ b/value-of/svrl-value-of-01.sch @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/value-of/svrl-value-of-01.xspec b/value-of/svrl-value-of-01.xspec new file mode 100644 index 0000000..dc77d02 --- /dev/null +++ b/value-of/svrl-value-of-01.xspec @@ -0,0 +1,11 @@ + + + + + + + + +