simple-xspec-wrapper 0.1.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +11 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +37 -0
- data/LICENSE.txt +21 -0
- data/README.md +49 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/xspec +16 -0
- data/lib/xspec/version.rb +3 -0
- data/lib/xspec.rb +256 -0
- data/simple-xspec-wrapper.gemspec +28 -0
- data/spec-test.xml +1125 -0
- data/vendor/xspec-1.0.0/.gitignore +7 -0
- data/vendor/xspec-1.0.0/.travis.yml +57 -0
- data/vendor/xspec-1.0.0/LICENSE +21 -0
- data/vendor/xspec-1.0.0/README.md +26 -0
- data/vendor/xspec-1.0.0/appveyor.yml +77 -0
- data/vendor/xspec-1.0.0/bin/xspec.bat +620 -0
- data/vendor/xspec-1.0.0/bin/xspec.sh +403 -0
- data/vendor/xspec-1.0.0/build.xml +369 -0
- data/vendor/xspec-1.0.0/editors/emacs/README +31 -0
- data/vendor/xspec-1.0.0/editors/emacs/schemas.xml +6 -0
- data/vendor/xspec-1.0.0/editors/oxygen/.cvsignore +2 -0
- data/vendor/xspec-1.0.0/editors/oxygen/README +11 -0
- data/vendor/xspec-1.0.0/editors/oxygen/build.xml +38 -0
- data/vendor/xspec-1.0.0/editors/oxygen/templates/xspec.xml +17 -0
- data/vendor/xspec-1.0.0/editors/oxygen/xspec.framework +175 -0
- data/vendor/xspec-1.0.0/find-examples.xml +37 -0
- data/vendor/xspec-1.0.0/find-examples.xsl +615 -0
- data/vendor/xspec-1.0.0/graphics/3angle-down.gif +0 -0
- data/vendor/xspec-1.0.0/graphics/3angle-right.gif +0 -0
- data/vendor/xspec-1.0.0/java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.class +0 -0
- data/vendor/xspec-1.0.0/java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.java +209 -0
- data/vendor/xspec-1.0.0/src/ant/find-test-failure.xsl +17 -0
- data/vendor/xspec-1.0.0/src/ant/get-schematron-phase.xsl +17 -0
- data/vendor/xspec-1.0.0/src/ant/locate-schematron.xsl +28 -0
- data/vendor/xspec-1.0.0/src/ant/make-path.js +4 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-common-tests.xsl +604 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-query-helper.xsl +152 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-query-tests.xsl +473 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-query-utils.xql +263 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-tests-helper.xsl +169 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-tests-utils.xsl +479 -0
- data/vendor/xspec-1.0.0/src/compiler/generate-xspec-tests.xsl +503 -0
- data/vendor/xspec-1.0.0/src/harnesses/basex/basex-standalone-xquery-harness.xproc +135 -0
- data/vendor/xspec-1.0.0/src/harnesses/basex/basex-xquery-harness.xproc +133 -0
- data/vendor/xspec-1.0.0/src/harnesses/exist/exist-xquery-harness.xproc +161 -0
- data/vendor/xspec-1.0.0/src/harnesses/harness-lib.xpl +327 -0
- data/vendor/xspec-1.0.0/src/harnesses/marklogic/ml-xquery-harness.xproc +143 -0
- data/vendor/xspec-1.0.0/src/harnesses/saxon/saxon-xquery-harness.xproc +108 -0
- data/vendor/xspec-1.0.0/src/harnesses/saxon/saxon-xslt-harness.xproc +85 -0
- data/vendor/xspec-1.0.0/src/harnesses/zorba/zorba-xquery-harness.xproc +134 -0
- data/vendor/xspec-1.0.0/src/reporter/coverage-report.xsl +378 -0
- data/vendor/xspec-1.0.0/src/reporter/format-utils.xsl +220 -0
- data/vendor/xspec-1.0.0/src/reporter/format-xspec-report-folding.xsl +164 -0
- data/vendor/xspec-1.0.0/src/reporter/format-xspec-report.xsl +410 -0
- data/vendor/xspec-1.0.0/src/reporter/junit-report.xsl +93 -0
- data/vendor/xspec-1.0.0/src/reporter/test-report.css +469 -0
- data/vendor/xspec-1.0.0/src/schemas/find-examples.rnc +90 -0
- data/vendor/xspec-1.0.0/src/schemas/xspec.rnc +304 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_abstract_expand.xsl +313 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_dsdl_include.xsl +1519 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_message.xsl +64 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_message_xslt2.xsl +64 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_skeleton_for_saxon.xsl +2306 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_skeleton_for_xslt1.xsl +1851 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_svrl_for_xslt1.xsl +614 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_svrl_for_xslt2.xsl +692 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/readme.txt +101 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-cs.xhtml +56 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-de.xhtml +55 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-en.xhtml +57 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-fr.xhtml +54 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-ja.xhtml +53 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-nl.xhtml +58 -0
- data/vendor/xspec-1.0.0/src/schematron/iso-schematron/schematron-skeleton-api.htm +723 -0
- data/vendor/xspec-1.0.0/src/schematron/sch-location-compare.xsl +139 -0
- data/vendor/xspec-1.0.0/src/schematron/schut-to-xspec.xsl +179 -0
- data/vendor/xspec-1.0.0/test/Makefile +117 -0
- data/vendor/xspec-1.0.0/test/README +5 -0
- data/vendor/xspec-1.0.0/test/catalog/xspec-160_catalog.xml +4 -0
- data/vendor/xspec-1.0.0/test/catalog/xspec-160_schematron.xspec +6 -0
- data/vendor/xspec-1.0.0/test/catalog/xspec-160_xslt.xspec +5 -0
- data/vendor/xspec-1.0.0/test/end-to-end/README.md +42 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/.gitignore +1 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/.gitignore +3 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-50-result-norm.html +74 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-55-result-norm.html +112 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-focus-1-result-norm.html +109 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-function-result-norm.html +118 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-import-result-norm.html +163 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-imported-result-norm.html +95 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-pending-result-norm.html +123 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-rule-result-norm.html +109 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-three-dots-result-norm.html +1237 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-50.xsl +7 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-50.xspec +10 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-55.xsl +2 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-55.xspec +18 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-focus-1.xspec +71 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-function.xspec +50 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-import.xspec +50 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-imported.xspec +48 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-pending.xspec +89 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-rule.xspec +76 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-three-dots.xsl +49 -0
- data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-three-dots.xspec +527 -0
- data/vendor/xspec-1.0.0/test/end-to-end/generate-expected.cmd +51 -0
- data/vendor/xspec-1.0.0/test/end-to-end/generate-expected.sh +25 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/_deserializer.xsl +53 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/_normalizer.xsl +192 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/_serializer.xsl +15 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/_util.xsl +35 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/compare.xsl +88 -0
- data/vendor/xspec-1.0.0/test/end-to-end/processor/normalize.xsl +28 -0
- data/vendor/xspec-1.0.0/test/end-to-end/run-e2e-tests.cmd +61 -0
- data/vendor/xspec-1.0.0/test/end-to-end/run-e2e-tests.sh +28 -0
- data/vendor/xspec-1.0.0/test/generate-tests-utils.xspec +636 -0
- data/vendor/xspec-1.0.0/test/generate-x-utils.xspec +173 -0
- data/vendor/xspec-1.0.0/test/generate-xspec-tests.xspec +64 -0
- data/vendor/xspec-1.0.0/test/run-xspec-tests.cmd +83 -0
- data/vendor/xspec-1.0.0/test/run-xspec-tests.sh +42 -0
- data/vendor/xspec-1.0.0/test/sch-location-compare.xspec +179 -0
- data/vendor/xspec-1.0.0/test/schematron/data/standards.xml +7 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-017.sch +9 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-018.sch +17 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-019.sch +13 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-020-01.sch +35 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-020.sch +32 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-021.sch +28 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-022.sch +18 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-xslt-compile.xsl +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-xslt-expand.xsl +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schematron-xslt-include.xsl +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-001-in.xspec +5 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-001-out.xspec +7 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-002-in.xspec +5 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-002-out.xspec +7 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-002.sch +4 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-003-in.xspec +7 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-003-out.xspec +9 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-004-in.xspec +20 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-004-out.xspec +22 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-005-in.xspec +6 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-005-out.xspec +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-006-in.xspec +11 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-006-out.xspec +13 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-007-in.xspec +7 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-007-out.xspec +9 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-007.xml +2 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-008-in.xspec +9 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-008-out.xspec +9 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-009-import-in.xspec +5 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-009-in.xspec +6 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-009-out.xspec +10 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-010-import.xspec +5 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-010-in.xspec +6 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-010-out.xspec +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-011-in.xspec +6 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-011-out.xspec +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-012-01.xml +4 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-012-02.xml +13 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-012-out.xspec +81 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-013-in.xspec +6 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-013-out.xspec +8 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-test.sch +4 -0
- data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-test.sch.xsl +4 -0
- data/vendor/xspec-1.0.0/test/schematron-01.sch +17 -0
- data/vendor/xspec-1.0.0/test/schematron-01.xml +14 -0
- data/vendor/xspec-1.0.0/test/schematron-01.xspec +14 -0
- data/vendor/xspec-1.0.0/test/schematron-012.xspec +83 -0
- data/vendor/xspec-1.0.0/test/schematron-014-01.xml +10 -0
- data/vendor/xspec-1.0.0/test/schematron-014.sch +16 -0
- data/vendor/xspec-1.0.0/test/schematron-014.xspec +11 -0
- data/vendor/xspec-1.0.0/test/schematron-015.sch +16 -0
- data/vendor/xspec-1.0.0/test/schematron-015.xspec +11 -0
- data/vendor/xspec-1.0.0/test/schematron-016.sch +19 -0
- data/vendor/xspec-1.0.0/test/schematron-016.xspec +171 -0
- data/vendor/xspec-1.0.0/test/schematron-017.xspec +26 -0
- data/vendor/xspec-1.0.0/test/schematron-018.xspec +120 -0
- data/vendor/xspec-1.0.0/test/schematron-019.xspec +16 -0
- data/vendor/xspec-1.0.0/test/schematron-020.xspec +53 -0
- data/vendor/xspec-1.0.0/test/schematron-021.xspec +27 -0
- data/vendor/xspec-1.0.0/test/schematron-022.xspec +15 -0
- data/vendor/xspec-1.0.0/test/schematron-param-001.xspec +50 -0
- data/vendor/xspec-1.0.0/test/schut-to-xspec-012.sch +27 -0
- data/vendor/xspec-1.0.0/test/schut-to-xspec.xspec +85 -0
- data/vendor/xspec-1.0.0/test/unit-expect-xsl.xspec +28 -0
- data/vendor/xspec-1.0.0/test/xspec-26.xsl +19 -0
- data/vendor/xspec-1.0.0/test/xspec-26.xspec +17 -0
- data/vendor/xspec-1.0.0/test/xspec-30.xml +2 -0
- data/vendor/xspec-1.0.0/test/xspec-30.xsl +6 -0
- data/vendor/xspec-1.0.0/test/xspec-30.xspec +8 -0
- data/vendor/xspec-1.0.0/test/xspec-33.xsl +7 -0
- data/vendor/xspec-1.0.0/test/xspec-33.xspec +15 -0
- data/vendor/xspec-1.0.0/test/xspec-46.xsl +7 -0
- data/vendor/xspec-1.0.0/test/xspec-46.xspec +9 -0
- data/vendor/xspec-1.0.0/test/xspec-72.xsl +13 -0
- data/vendor/xspec-1.0.0/test/xspec-72.xspec +19 -0
- data/vendor/xspec-1.0.0/test/xspec-bat.cmd +757 -0
- data/vendor/xspec-1.0.0/test/xspec-focus-2.xspec +91 -0
- data/vendor/xspec-1.0.0/test/xspec-junit.xspec +78 -0
- data/vendor/xspec-1.0.0/test/xspec-result-naming-collision.xml +1003 -0
- data/vendor/xspec-1.0.0/test/xspec-result-naming-collision.xslt +10 -0
- data/vendor/xspec-1.0.0/test/xspec-result-naming-collision.xspec +13 -0
- data/vendor/xspec-1.0.0/test/xspec-tested.xql +44 -0
- data/vendor/xspec-1.0.0/test/xspec-tested.xsl +64 -0
- data/vendor/xspec-1.0.0/test/xspec-variable.xml +3 -0
- data/vendor/xspec-1.0.0/test/xspec-variable.xspec +58 -0
- data/vendor/xspec-1.0.0/test/xspec-xslt3.xsl +13 -0
- data/vendor/xspec-1.0.0/test/xspec-xslt3.xspec +12 -0
- data/vendor/xspec-1.0.0/test/xspec.bats +420 -0
- data/vendor/xspec-1.0.0/tutorial/escape-for-regex.xslt +40 -0
- data/vendor/xspec-1.0.0/tutorial/escape-for-regex.xspec +75 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-01.sch +17 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-01.xml +11 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-01.xspec +14 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-PhaseA.xspec +11 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-PhaseB.xspec +12 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-import1.xspec +10 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-import2.xspec +8 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-import3.xspec +10 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02.sch +58 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-02.xml +19 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-03-doc1.xml +6 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-03-doc2.xml +7 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-03.sch +29 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-03.xspec +63 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-04.sch +20 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/demo-04.xspec +33 -0
- data/vendor/xspec-1.0.0/tutorial/schematron/quickfix.sch +81 -0
- data/vendor/xspec-1.0.0/tutorial/xquery-tutorial.xq +8 -0
- data/vendor/xspec-1.0.0/tutorial/xquery-tutorial.xspec +16 -0
- data/vendor/xspec-1.0.0/xproject/project.xml +8 -0
- data/vendor/xspec-1.0.0/xproject/release-project.xsl +41 -0
- metadata +341 -0
@@ -0,0 +1,139 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
3
|
+
xmlns:x="http://www.jenitennison.com/xslt/xspec" version="2.0">
|
4
|
+
|
5
|
+
<!-- function x:schematron-location-compare
|
6
|
+
|
7
|
+
This function is used in Schematron tests to compare
|
8
|
+
an expected @location XPath in a test scenario with
|
9
|
+
a SVRL @location XPath in Schematron output.
|
10
|
+
|
11
|
+
If the Schematron uses XPath 1.0 the SVRL location XPath has all namespaced
|
12
|
+
elements use a wildcard namespace, so only the element name can be matched.
|
13
|
+
If XPath 1.0 is detected then namespace prefixes are removed from the comparison.
|
14
|
+
|
15
|
+
Parameters:
|
16
|
+
|
17
|
+
expect-location : @location from x:expect-assert or x:expect-report
|
18
|
+
|
19
|
+
svrl-location : @location from svrl:failed-assert or svrl:successful-report
|
20
|
+
|
21
|
+
namespaces : elements that contain namespace definitions in attributes @uri and @prefix
|
22
|
+
<svrl:ns-prefix-in-attribute-values uri="http://example.com/ns1" prefix="ex1"/>
|
23
|
+
<sch:ns uri="http://example.com/ns1" prefix="ex1"/>
|
24
|
+
-->
|
25
|
+
<xsl:function name="x:schematron-location-compare" as="xs:boolean">
|
26
|
+
<xsl:param name="expect-location" as="xs:string?"/>
|
27
|
+
<xsl:param name="svrl-location" as="xs:string?"/>
|
28
|
+
<xsl:param name="namespaces" as="element()*"/>
|
29
|
+
<xsl:variable name="svrl-expand1"
|
30
|
+
select="
|
31
|
+
x:schematron-location-expand-xpath1(
|
32
|
+
x:schematron-location-expand-attributes($svrl-location, $namespaces))"/>
|
33
|
+
<xsl:variable name="svrl-expand2" select="x:schematron-location-expand-xpath2($svrl-expand1, $namespaces)"/>
|
34
|
+
<xsl:variable name="expect-expand"
|
35
|
+
select="
|
36
|
+
x:schematron-location-expand-xpath1-expect(
|
37
|
+
x:schematron-location-expand-attributes($expect-location, $namespaces), $svrl-location, $namespaces)"/>
|
38
|
+
<!--xsl:variable name="expect-parts" select="tokenize($expect-expand, '/')[.]"/>
|
39
|
+
<xsl:variable name="svrl-parts" select="tokenize($svrl-expand2, '/')[.]"/-->
|
40
|
+
<xsl:sequence select="
|
41
|
+
($expect-location = $svrl-location) or
|
42
|
+
(replace($svrl-expand2, '^/|\[1\]', '') = replace($expect-expand, '^/|\[1\]', ''))
|
43
|
+
"/>
|
44
|
+
<!-- (: every $i in (1 to max((count($svrl-parts),count($expect-parts)))) satisfies
|
45
|
+
replace($expect-parts[$i], '\[1\]$', '') = replace($svrl-parts[$i], '\[1\]$', '') :) -->
|
46
|
+
</xsl:function>
|
47
|
+
|
48
|
+
<!-- function x:schematron-location-expand-xpath2
|
49
|
+
|
50
|
+
This function is used in Schematron tests to reformat XPath location attribute values
|
51
|
+
from the format Schematron produces for XPath 2.0 to human friendly XPath
|
52
|
+
using namespace prefixes defined in Schematron ns elements.
|
53
|
+
|
54
|
+
The XPath 2.0 format produced by Schematron is:
|
55
|
+
*:name[namespace-uri()='http://example.com/ns1']
|
56
|
+
-->
|
57
|
+
<xsl:function name="x:schematron-location-expand-xpath2" as="xs:string">
|
58
|
+
<xsl:param name="location" as="xs:string?"/>
|
59
|
+
<xsl:param name="namespaces" as="element()*"/>
|
60
|
+
<xsl:choose>
|
61
|
+
<xsl:when test="$namespaces">
|
62
|
+
<xsl:variable name="match"
|
63
|
+
select="concat('\*:([^\[]+)\[namespace\-uri\(\)=', codepoints-to-string(39), replace($namespaces[1]/@uri, '([\.\\\?\*\+\|\^\$\{\}\(\)\[\]])', '\\$1'), codepoints-to-string(39), '\]')"/>
|
64
|
+
<xsl:variable name="replace" select="concat($namespaces[1]/@prefix, ':$1')"/>
|
65
|
+
<xsl:value-of
|
66
|
+
select="x:schematron-location-expand-xpath2(replace($location, $match, $replace), subsequence($namespaces, 2))"
|
67
|
+
/>
|
68
|
+
</xsl:when>
|
69
|
+
<xsl:otherwise>
|
70
|
+
<xsl:value-of select="$location"/>
|
71
|
+
</xsl:otherwise>
|
72
|
+
</xsl:choose>
|
73
|
+
</xsl:function>
|
74
|
+
|
75
|
+
<!-- function x:schematron-location-expand-xpath1
|
76
|
+
|
77
|
+
This function is used in Schematron tests to reformat XPath location attribute values
|
78
|
+
from the format Schematron produces for XPath 1.0 to human friendly XPath.
|
79
|
+
Namespace URIs are not available so effectively the XPath does not recognize namespaces.
|
80
|
+
|
81
|
+
The XPath 1.0 format produced by Schematron is:
|
82
|
+
*[local-name()='name']
|
83
|
+
-->
|
84
|
+
<xsl:function name="x:schematron-location-expand-xpath1" as="xs:string">
|
85
|
+
<xsl:param name="location" as="xs:string?"/>
|
86
|
+
<xsl:variable name="match"
|
87
|
+
select="concat('\*\[local-name\(\)=', codepoints-to-string(39), '([^', codepoints-to-string(39), ']+)', codepoints-to-string(39), '\]')"/>
|
88
|
+
<xsl:value-of select="replace($location, $match, '$1')"/>
|
89
|
+
</xsl:function>
|
90
|
+
|
91
|
+
<!-- function schematron-location-expand-xpath1-expect
|
92
|
+
|
93
|
+
|
94
|
+
-->
|
95
|
+
<xsl:function name="x:schematron-location-expand-xpath1-expect" as="xs:string">
|
96
|
+
<xsl:param name="expect-location" as="xs:string?"/>
|
97
|
+
<xsl:param name="svrl-location" as="xs:string?"/>
|
98
|
+
<xsl:param name="namespaces" as="element()*"/>
|
99
|
+
<xsl:value-of
|
100
|
+
select="
|
101
|
+
if ($namespaces and contains($svrl-location, '*[local-name()=')) then
|
102
|
+
replace($expect-location, concat('(', string-join(for $prefix in $namespaces/@prefix
|
103
|
+
return
|
104
|
+
concat($prefix, ':'), '|'), ')'), '')
|
105
|
+
else
|
106
|
+
$expect-location"
|
107
|
+
/>
|
108
|
+
</xsl:function>
|
109
|
+
|
110
|
+
<!-- function schematron-location-expand-attributes
|
111
|
+
|
112
|
+
This function reformats namespaced attribute nodes in XPath to use the
|
113
|
+
namespace prefix defined in the Schematron.
|
114
|
+
|
115
|
+
The XPath format produced by Schematron for XPath 1 and 2, which is also
|
116
|
+
produced by oXygen's Copy XPath function, is:
|
117
|
+
|
118
|
+
@*[namespace-uri()='http://example.com/ns2' and local-name()='type']
|
119
|
+
-->
|
120
|
+
<xsl:function name="x:schematron-location-expand-attributes" as="xs:string">
|
121
|
+
<xsl:param name="location" as="xs:string?"/>
|
122
|
+
<xsl:param name="namespaces" as="element()*"/>
|
123
|
+
<xsl:choose>
|
124
|
+
<xsl:when test="$namespaces">
|
125
|
+
<xsl:variable name="match"
|
126
|
+
select="concat('@\*\[namespace-uri\(\)=', codepoints-to-string(39), replace($namespaces[1]/@uri, '([\.\\\?\*\+\|\^\$\{\}\(\)\[\]])', '\\$1'), codepoints-to-string(39), ' and local-name\(\)=', codepoints-to-string(39), '([^', codepoints-to-string(39), ']+)', codepoints-to-string(39), '\]')"/>
|
127
|
+
<xsl:variable name="replace" select="concat('@', $namespaces[1]/@prefix, ':$1')"/>
|
128
|
+
<xsl:value-of
|
129
|
+
select="x:schematron-location-expand-attributes(replace($location, $match, $replace), subsequence($namespaces, 2))"
|
130
|
+
/>
|
131
|
+
</xsl:when>
|
132
|
+
<xsl:otherwise>
|
133
|
+
<xsl:value-of select="$location"/>
|
134
|
+
</xsl:otherwise>
|
135
|
+
</xsl:choose>
|
136
|
+
</xsl:function>
|
137
|
+
|
138
|
+
|
139
|
+
</xsl:stylesheet>
|
@@ -0,0 +1,179 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
|
3
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
4
|
+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
5
|
+
xmlns:x="http://www.jenitennison.com/xslt/xspec"
|
6
|
+
exclude-result-prefixes="xs" version="2.0">
|
7
|
+
|
8
|
+
<xsl:param name="stylesheet" select="concat(x:description/@schematron, '.xsl')"/>
|
9
|
+
<xsl:param name="test_dir" select="'xspec'"/>
|
10
|
+
|
11
|
+
|
12
|
+
<xsl:variable name="error" select="('error', 'fatal')"/>
|
13
|
+
<xsl:variable name="warn" select="('warn', 'warning')"/>
|
14
|
+
<xsl:variable name="info" select="('info', 'information')"/>
|
15
|
+
|
16
|
+
|
17
|
+
<xsl:template match="@* | node()" priority="-2">
|
18
|
+
<xsl:copy>
|
19
|
+
<xsl:apply-templates select="@* | node()"/>
|
20
|
+
</xsl:copy>
|
21
|
+
</xsl:template>
|
22
|
+
|
23
|
+
<xsl:template match="x:description[@schematron]">
|
24
|
+
<xsl:element name="x:description">
|
25
|
+
<xsl:namespace name="svrl" select="'http://purl.oclc.org/dsdl/svrl'"/>
|
26
|
+
<xsl:apply-templates select="@*[not(name() = ('stylesheet'))]"/>
|
27
|
+
<xsl:element name="x:scenario">
|
28
|
+
<xsl:attribute name="label">
|
29
|
+
<xsl:text>Schematron: "</xsl:text>
|
30
|
+
<xsl:value-of select="@schematron"/>
|
31
|
+
<xsl:text>"</xsl:text>
|
32
|
+
<xsl:if test="x:param[@name='phase']">
|
33
|
+
<xsl:value-of select="concat(' phase: ', x:param[@name='phase'][1]/(@select,string())[1])"/>
|
34
|
+
</xsl:if>
|
35
|
+
</xsl:attribute>
|
36
|
+
</xsl:element>
|
37
|
+
<xsl:apply-templates select="node()"/>
|
38
|
+
</xsl:element>
|
39
|
+
</xsl:template>
|
40
|
+
|
41
|
+
<xsl:template match="@schematron">
|
42
|
+
<xsl:attribute name="stylesheet" select="$stylesheet"/>
|
43
|
+
<xsl:variable name="path" select="resolve-uri(string(), base-uri())"/>
|
44
|
+
<xsl:for-each select="doc($path)/sch:schema/sch:ns" xmlns:sch="http://purl.oclc.org/dsdl/schematron">
|
45
|
+
<xsl:namespace name="{./@prefix}" select="./@uri"/>
|
46
|
+
</xsl:for-each>
|
47
|
+
</xsl:template>
|
48
|
+
|
49
|
+
<xsl:template match="x:import">
|
50
|
+
<xsl:variable name="href" select="resolve-uri(@href, base-uri())"/>
|
51
|
+
<xsl:choose>
|
52
|
+
<xsl:when test="doc($href)//*[
|
53
|
+
self::x:expect-assert | self::x:expect-not-assert |
|
54
|
+
self::x:expect-report | self::x:expect-not-report |
|
55
|
+
self::x:expect-valid | self::x:description[@schematron] ]">
|
56
|
+
<xsl:comment>BEGIN IMPORT "<xsl:value-of select="@href"/>"</xsl:comment>
|
57
|
+
<xsl:apply-templates select="doc($href)/x:description/node()"/>
|
58
|
+
<xsl:comment>END IMPORT "<xsl:value-of select="@href"/>"</xsl:comment>
|
59
|
+
</xsl:when>
|
60
|
+
<xsl:otherwise>
|
61
|
+
<xsl:next-match/>
|
62
|
+
</xsl:otherwise>
|
63
|
+
</xsl:choose>
|
64
|
+
</xsl:template>
|
65
|
+
|
66
|
+
<xsl:template match="x:context[not(@href)][
|
67
|
+
parent::*/x:expect-assert | parent::*/x:expect-not-assert |
|
68
|
+
parent::*/x:expect-report | parent::*/x:expect-not-report |
|
69
|
+
parent::*/x:expect-valid | ancestor::x:description[@schematron] ]">
|
70
|
+
<xsl:variable name="file" select="concat($test_dir, '/', 'context-', generate-id(), '.xml')"/>
|
71
|
+
<xsl:result-document href="{$file}">
|
72
|
+
<xsl:copy-of select="./node()"/>
|
73
|
+
</xsl:result-document>
|
74
|
+
<xsl:element name="x:context">
|
75
|
+
<xsl:attribute name="href" select="$file"/>
|
76
|
+
</xsl:element>
|
77
|
+
</xsl:template>
|
78
|
+
|
79
|
+
<xsl:template match="x:expect-assert">
|
80
|
+
<xsl:element name="x:expect">
|
81
|
+
<xsl:call-template name="make-label"/>
|
82
|
+
<xsl:attribute name="test">
|
83
|
+
<xsl:sequence select="if (@count) then 'count' else 'exists'"/>
|
84
|
+
<xsl:sequence select="'(svrl:schematron-output/svrl:failed-assert'"/>
|
85
|
+
<xsl:apply-templates select="@*" mode="make-predicate"/>
|
86
|
+
<xsl:sequence select="')'"/>
|
87
|
+
<xsl:sequence select="current()[@count]/concat(' eq ', @count)"/>
|
88
|
+
</xsl:attribute>
|
89
|
+
</xsl:element>
|
90
|
+
</xsl:template>
|
91
|
+
|
92
|
+
<xsl:template match="x:expect-not-assert">
|
93
|
+
<xsl:element name="x:expect">
|
94
|
+
<xsl:call-template name="make-label"/>
|
95
|
+
<xsl:attribute name="test">
|
96
|
+
<xsl:sequence select="'boolean(svrl:schematron-output[svrl:fired-rule]) and empty(svrl:schematron-output/svrl:failed-assert'"/>
|
97
|
+
<xsl:apply-templates select="@*" mode="make-predicate"/>
|
98
|
+
<xsl:sequence select="')'"/>
|
99
|
+
</xsl:attribute>
|
100
|
+
</xsl:element>
|
101
|
+
</xsl:template>
|
102
|
+
|
103
|
+
<xsl:template match="x:expect-report">
|
104
|
+
<xsl:element name="x:expect">
|
105
|
+
<xsl:call-template name="make-label"/>
|
106
|
+
<xsl:attribute name="test">
|
107
|
+
<xsl:sequence select="if (@count) then 'count' else 'exists'"/>
|
108
|
+
<xsl:sequence select="'(svrl:schematron-output/svrl:successful-report'"/>
|
109
|
+
<xsl:apply-templates select="@*" mode="make-predicate"/>
|
110
|
+
<xsl:sequence select="')'"/>
|
111
|
+
<xsl:sequence select="current()[@count]/concat(' eq ', @count)"/>
|
112
|
+
</xsl:attribute>
|
113
|
+
</xsl:element>
|
114
|
+
</xsl:template>
|
115
|
+
|
116
|
+
|
117
|
+
<xsl:template match="x:expect-not-report">
|
118
|
+
<xsl:element name="x:expect">
|
119
|
+
<xsl:call-template name="make-label"/>
|
120
|
+
<xsl:attribute name="test">
|
121
|
+
<xsl:sequence select="'boolean(svrl:schematron-output[svrl:fired-rule]) and empty(svrl:schematron-output/svrl:successful-report'"/>
|
122
|
+
<xsl:apply-templates select="@*" mode="make-predicate"/>
|
123
|
+
<xsl:sequence select="')'"/>
|
124
|
+
</xsl:attribute>
|
125
|
+
</xsl:element>
|
126
|
+
</xsl:template>
|
127
|
+
|
128
|
+
<xsl:template match="@location" mode="make-predicate">
|
129
|
+
<xsl:variable name="escaped" select="if (not(contains(., codepoints-to-string(39)))) then
|
130
|
+
concat(codepoints-to-string(39), ., codepoints-to-string(39)) else
|
131
|
+
concat('concat(', codepoints-to-string(39), replace(., codepoints-to-string(39), concat(codepoints-to-string(39), ', codepoints-to-string(39), ', codepoints-to-string(39))), codepoints-to-string(39), ')')"/>
|
132
|
+
<xsl:sequence select="concat('[x:schematron-location-compare(', $escaped, ', @location, preceding-sibling::svrl:ns-prefix-in-attribute-values)]')"/>
|
133
|
+
</xsl:template>
|
134
|
+
|
135
|
+
<xsl:template match="@id | @role" mode="make-predicate">
|
136
|
+
<xsl:sequence select="concat('[(@', local-name(.),
|
137
|
+
', preceding-sibling::svrl:fired-rule[1]/@',local-name(.),
|
138
|
+
', preceding-sibling::svrl:active-pattern[1]/@',local-name(.),
|
139
|
+
')[1] = ', codepoints-to-string(39), ., codepoints-to-string(39), ']')"/>
|
140
|
+
</xsl:template>
|
141
|
+
|
142
|
+
<xsl:template match="@id[parent::x:expect-rule] | @context[parent::x:expect-rule]" mode="make-predicate">
|
143
|
+
<xsl:sequence select="concat('[@', local-name(.),
|
144
|
+
' = ', codepoints-to-string(39), ., codepoints-to-string(39), ']')"/>
|
145
|
+
</xsl:template>
|
146
|
+
|
147
|
+
<xsl:template match="@count | @label" mode="make-predicate"/>
|
148
|
+
|
149
|
+
<xsl:template name="make-label">
|
150
|
+
<xsl:attribute name="label" select="string-join((@label, tokenize(local-name(),'-')[.=('report','assert','not','rule')], @id, @role, @location, @context, current()[@count]/string('count:'), @count), ' ')"/>
|
151
|
+
</xsl:template>
|
152
|
+
|
153
|
+
<xsl:template match="x:expect-valid">
|
154
|
+
<xsl:element name="x:expect">
|
155
|
+
<xsl:attribute name="label" select="'valid'"/>
|
156
|
+
<xsl:attribute name="test" select="concat(
|
157
|
+
'boolean(svrl:schematron-output[svrl:fired-rule]) and
|
158
|
+
not(boolean((svrl:schematron-output/svrl:failed-assert union svrl:schematron-output/svrl:successful-report)[
|
159
|
+
not(@role) or @role = (',
|
160
|
+
string-join(for $e in $error return concat(codepoints-to-string(39), $e, codepoints-to-string(39)), ','),
|
161
|
+
')]))'
|
162
|
+
)"/>
|
163
|
+
</xsl:element>
|
164
|
+
</xsl:template>
|
165
|
+
|
166
|
+
<xsl:template match="x:expect-rule">
|
167
|
+
<xsl:element name="x:expect">
|
168
|
+
<xsl:call-template name="make-label"/>
|
169
|
+
<xsl:attribute name="test">
|
170
|
+
<xsl:sequence select="if (@count) then 'count' else 'exists'"/>
|
171
|
+
<xsl:sequence select="'(svrl:schematron-output/svrl:fired-rule'"/>
|
172
|
+
<xsl:apply-templates select="@*" mode="make-predicate"/>
|
173
|
+
<xsl:sequence select="')'"/>
|
174
|
+
<xsl:sequence select="current()[@count]/concat(' eq ', @count)"/>
|
175
|
+
</xsl:attribute>
|
176
|
+
</xsl:element>
|
177
|
+
</xsl:template>
|
178
|
+
|
179
|
+
</xsl:stylesheet>
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# ========================================================================== #
|
2
|
+
# File: test/Makefile #
|
3
|
+
# Author: Jeni Tennsion #
|
4
|
+
# Tags: #
|
5
|
+
# Copyright (c) 2010 Jeni Tennsion (see end of file.) #
|
6
|
+
# -------------------------------------------------------------------------- #
|
7
|
+
# TODO: Use the XSpec test harnesses (in XProc) themselves, by using
|
8
|
+
# XProject directly. Adapt the process to be able (for some tests) to
|
9
|
+
# compile some XSpec code and test either (1) its report or (2) the result
|
10
|
+
# of its compilation.
|
11
|
+
# ----------------------------------------------------------------------------
|
12
|
+
# To use this Makefile, $SAXON_HOME must be set to a directory that
|
13
|
+
# contains either saxon9.jar (for B in 9.1 or below) or saxon9he.jar
|
14
|
+
# (for HE in 9.2 and above). Set it the usual way you set environ
|
15
|
+
# variables.
|
16
|
+
# ----------------------------------------------------------------------------
|
17
|
+
|
18
|
+
|
19
|
+
# the classpath to invoke Saxon
|
20
|
+
CP=$$SAXON_HOME/saxon9he.jar:$$SAXON_HOME/saxon9.jar
|
21
|
+
# invoke Saxon as XSLT processor
|
22
|
+
XSLT=java -cp $(CP) net.sf.saxon.Transform
|
23
|
+
# invoke Saxon as XQuery processor
|
24
|
+
XQUERY=java -cp $(CP) net.sf.saxon.Query
|
25
|
+
|
26
|
+
### MAIN TARGETS ###
|
27
|
+
|
28
|
+
# run all tests
|
29
|
+
all: xslt xquery
|
30
|
+
|
31
|
+
# run XSLT tests
|
32
|
+
xslt: xspec-function-xsl.html \
|
33
|
+
xspec-rule-xsl.html \
|
34
|
+
xspec-import-xsl.html \
|
35
|
+
xspec-focus-1-xsl.html \
|
36
|
+
xspec-focus-2-xsl.html \
|
37
|
+
xspec-pending-xsl.html \
|
38
|
+
xspec-variable-xsl.html \
|
39
|
+
generate-tests-utils-xsl.html \
|
40
|
+
generate-xspec-tests-xsl.html
|
41
|
+
|
42
|
+
# run XQuery tests
|
43
|
+
xquery: xspec-function-xq.html \
|
44
|
+
xspec-import-xq.html \
|
45
|
+
xspec-focus-1-xq.html \
|
46
|
+
xspec-focus-2-xq.html \
|
47
|
+
xspec-pending-xq.html \
|
48
|
+
xspec-variable-xq.html \
|
49
|
+
generate-tests-utils-xq.html
|
50
|
+
|
51
|
+
# clean result files
|
52
|
+
clean:
|
53
|
+
rm -fv *.html
|
54
|
+
|
55
|
+
### FILE RULES ###
|
56
|
+
|
57
|
+
# compile to XSLT
|
58
|
+
%.xsl: %.xspec
|
59
|
+
$(XSLT) \
|
60
|
+
-xsl:../src/compiler/generate-xspec-tests.xsl \
|
61
|
+
-s:$< \
|
62
|
+
-o:$@
|
63
|
+
|
64
|
+
# compile to XQuery
|
65
|
+
%.xq: %.xspec
|
66
|
+
$(XSLT) \
|
67
|
+
-xsl:../src/compiler/generate-query-tests.xsl \
|
68
|
+
-s:$< \
|
69
|
+
-o:$@
|
70
|
+
|
71
|
+
# run an XSLT compiled suite
|
72
|
+
%-xsl.xml: %.xsl xspec-tested.xsl
|
73
|
+
$(XSLT) \
|
74
|
+
-xsl:$< \
|
75
|
+
-o:$@ \
|
76
|
+
-it:"{http://www.jenitennison.com/xslt/xspec}main"
|
77
|
+
|
78
|
+
# run an XQuery compiled suite
|
79
|
+
%-xq.xml: %.xq xspec-tested.xql
|
80
|
+
$(XQUERY) \
|
81
|
+
-o:$@ $< '!indent=yes'
|
82
|
+
|
83
|
+
# format an XML report to HTML
|
84
|
+
%.html: %.xml
|
85
|
+
$(XSLT) \
|
86
|
+
-xsl:../src/reporter/format-xspec-report.xsl \
|
87
|
+
-s:$< \
|
88
|
+
-o:$@
|
89
|
+
|
90
|
+
|
91
|
+
# -------------------------------------------------------------------------- #
|
92
|
+
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. #
|
93
|
+
# #
|
94
|
+
# Copyright (c) 2010 Jeni Tennsion #
|
95
|
+
# #
|
96
|
+
# The contents of this file are subject to the MIT License (see the URI #
|
97
|
+
# http://www.opensource.org/licenses/mit-license.php for details). #
|
98
|
+
# #
|
99
|
+
# Permission is hereby granted, free of charge, to any person obtaining #
|
100
|
+
# a copy of this software and associated documentation files (the #
|
101
|
+
# "Software"), to deal in the Software without restriction, including #
|
102
|
+
# without limitation the rights to use, copy, modify, merge, publish, #
|
103
|
+
# distribute, sublicense, and/or sell copies of the Software, and to #
|
104
|
+
# permit persons to whom the Software is furnished to do so, subject to #
|
105
|
+
# the following conditions: #
|
106
|
+
# #
|
107
|
+
# The above copyright notice and this permission notice shall be #
|
108
|
+
# included in all copies or substantial portions of the Software. #
|
109
|
+
# #
|
110
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, #
|
111
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF #
|
112
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. #
|
113
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY #
|
114
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, #
|
115
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE #
|
116
|
+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #
|
117
|
+
# -------------------------------------------------------------------------- #
|
@@ -0,0 +1,5 @@
|
|
1
|
+
Those test suites try to cover all features of XSpec, and are aimed to
|
2
|
+
be run as any other suites to test a specific implementation of XSpec.
|
3
|
+
This is NOT an automated test set, as which test must pass and which
|
4
|
+
test must fail is not autmatically checked. We need something better,
|
5
|
+
but this is better than nothing.
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<?xml-model href="../../src/schemas/xspec.rnc" type="application/relax-ng-compact-syntax"?>
|
3
|
+
<x:description schematron="xspec-tutorial:/schematron/demo-04.sch"
|
4
|
+
xmlns:x="http://www.jenitennison.com/xslt/xspec">
|
5
|
+
<x:import href="xspec-tutorial:/schematron/demo-04.xspec" />
|
6
|
+
</x:description>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<x:description stylesheet="xspec-tutorial:/escape-for-regex.xslt"
|
3
|
+
xmlns:functx="http://www.functx.com" xmlns:x="http://www.jenitennison.com/xslt/xspec">
|
4
|
+
<x:import href="xspec-tutorial:/escape-for-regex.xspec" />
|
5
|
+
</x:description>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
This procedure is a primitive end-to-end testing for XSpec itself.
|
2
|
+
|
3
|
+
The primary goal is to verify that XSpec is generating the report HTML files as expected. The test should be done as simply as possible and without using XSpec itself.
|
4
|
+
|
5
|
+
## Preparing the expected HTML files
|
6
|
+
|
7
|
+
First you need to set up the expected HTML files. This is a manual operation which you have to perform only once.
|
8
|
+
|
9
|
+
1. Put `*.xspec` files into the `cases` directory.
|
10
|
+
|
11
|
+
1. Run `./generate-expected.sh` (or `.cmd`).
|
12
|
+
|
13
|
+
The script executes the `cases/*.xspec` files.
|
14
|
+
|
15
|
+
In the `cases/expected` directory, two kinds of the report HTML files are generated:
|
16
|
+
|
17
|
+
* Original ones: `*-result.html`
|
18
|
+
* Normalized ones: `*-result-norm.html`
|
19
|
+
|
20
|
+
1. Verify that the original ones (`*-result.html`) contain the scenario results as expected.
|
21
|
+
|
22
|
+
1. Compare the normalized ones (`*-result-norm.html`) with the original ones (`*-result.html`).
|
23
|
+
|
24
|
+
Verify that they are essentially identical. Only the transient parts (`href`, `id`, datetime and file path) should be different.
|
25
|
+
|
26
|
+
1. Commit the normalized ones (`*-result-norm.html`) to the repository. (You can discard the other sibling files.)
|
27
|
+
|
28
|
+
They are called the expected HTML files hereafter.
|
29
|
+
|
30
|
+
## Running the regular tests
|
31
|
+
|
32
|
+
Once the expected HTML files are prepared, you can run tests regularly by executing `./run-e2e-tests.sh` (or `.cmd`).
|
33
|
+
|
34
|
+
The script performs these tasks in sequence:
|
35
|
+
|
36
|
+
1. Executes the `cases/*.xspec` files.
|
37
|
+
|
38
|
+
The report HTML files are generated: `cases/xspec/*-result.html`
|
39
|
+
|
40
|
+
1. Loads the report HTML files, normalizes them on memory, and compares them with the expected HTML files (`cases/expected/*-result-norm.html`).
|
41
|
+
|
42
|
+
If they are different, the test is considered as failure.
|
@@ -0,0 +1 @@
|
|
1
|
+
/xspec/
|
@@ -0,0 +1,74 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?><html xmlns:test="http://www.jenitennison.com/xslt/unit-test" xmlns="http://www.w3.org/1999/xhtml">
|
2
|
+
<head>
|
3
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
4
|
+
<title>Test Report for xspec-50.xsl (passed: 0 / pending: 0 / failed: 1 / total: 1)</title>
|
5
|
+
<link rel="stylesheet" type="text/css" href="../../../../src/reporter/test-report.css" />
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<h1>Test Report</h1>
|
9
|
+
<p>Stylesheet: <a href="xspec-50.xsl">xspec-50.xsl</a></p>
|
10
|
+
<p>Tested: ONCE-UPON-A-TIME</p>
|
11
|
+
<h2>Contents</h2>
|
12
|
+
<table class="xspec">
|
13
|
+
<col width="75%" />
|
14
|
+
<col width="6.25%" />
|
15
|
+
<col width="6.25%" />
|
16
|
+
<col width="6.25%" />
|
17
|
+
<col width="6.25%" />
|
18
|
+
<thead>
|
19
|
+
<tr>
|
20
|
+
<th></th>
|
21
|
+
<th class="totals">passed: 0</th>
|
22
|
+
<th class="totals">pending: 0</th>
|
23
|
+
<th class="totals">failed: 1</th>
|
24
|
+
<th class="totals">total: 1</th>
|
25
|
+
</tr>
|
26
|
+
</thead>
|
27
|
+
<tbody>
|
28
|
+
<tr class="failed">
|
29
|
+
<th><a href="#ELEM-31">Expecting xs:hexBinary('0123') when $x:result is xs:untypedAtomic('0123')</a></th>
|
30
|
+
<th class="totals">0</th>
|
31
|
+
<th class="totals">0</th>
|
32
|
+
<th class="totals">1</th>
|
33
|
+
<th class="totals">1</th>
|
34
|
+
</tr>
|
35
|
+
</tbody>
|
36
|
+
</table>
|
37
|
+
<div id="ELEM-31">
|
38
|
+
<h2 class="failed">Expecting xs:hexBinary('0123') when $x:result is xs:untypedAtomic('0123')<span class="scenario-totals">passed: 0 / pending: 0 / failed: 1 / total: 1</span></h2>
|
39
|
+
<table class="xspec" id="ELEM-33">
|
40
|
+
<col width="75%" />
|
41
|
+
<col width="25%" />
|
42
|
+
<tbody>
|
43
|
+
<tr class="failed">
|
44
|
+
<th>Expecting xs:hexBinary('0123') when $x:result is xs:untypedAtomic('0123')</th>
|
45
|
+
<th>passed: 0 / pending: 0 / failed: 1 / total: 1</th>
|
46
|
+
</tr>
|
47
|
+
<tr class="failed">
|
48
|
+
<td><a href="#ELEM-45">must generate a failure report HTML which reads [Result] = "xs:untypedAtomic('0123')"
|
49
|
+
and [Expected Result] = "xs:hexBinary('0123')"</a></td>
|
50
|
+
<td>Failure</td>
|
51
|
+
</tr>
|
52
|
+
</tbody>
|
53
|
+
</table>
|
54
|
+
<h3 id="ELEM-31">Expecting xs:hexBinary('0123') when $x:result is xs:untypedAtomic('0123')</h3>
|
55
|
+
<h4 id="ELEM-45">must generate a failure report HTML which reads [Result] = "xs:untypedAtomic('0123')"
|
56
|
+
and [Expected Result] = "xs:hexBinary('0123')"
|
57
|
+
</h4>
|
58
|
+
<table class="xspecResult">
|
59
|
+
<thead>
|
60
|
+
<tr>
|
61
|
+
<th>Result</th>
|
62
|
+
<th>Expected Result</th>
|
63
|
+
</tr>
|
64
|
+
</thead>
|
65
|
+
<tbody>
|
66
|
+
<tr>
|
67
|
+
<td><pre>xs:untypedAtomic('0123')</pre></td>
|
68
|
+
<td><pre>xs:hexBinary('0123')</pre></td>
|
69
|
+
</tr>
|
70
|
+
</tbody>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
</body>
|
74
|
+
</html>
|