simple-xspec-wrapper 0.1.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +3 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +11 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +6 -0
  8. data/Gemfile.lock +37 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +49 -0
  11. data/Rakefile +6 -0
  12. data/bin/console +14 -0
  13. data/bin/setup +8 -0
  14. data/exe/xspec +16 -0
  15. data/lib/xspec/version.rb +3 -0
  16. data/lib/xspec.rb +256 -0
  17. data/simple-xspec-wrapper.gemspec +28 -0
  18. data/spec-test.xml +1125 -0
  19. data/vendor/xspec-1.0.0/.gitignore +7 -0
  20. data/vendor/xspec-1.0.0/.travis.yml +57 -0
  21. data/vendor/xspec-1.0.0/LICENSE +21 -0
  22. data/vendor/xspec-1.0.0/README.md +26 -0
  23. data/vendor/xspec-1.0.0/appveyor.yml +77 -0
  24. data/vendor/xspec-1.0.0/bin/xspec.bat +620 -0
  25. data/vendor/xspec-1.0.0/bin/xspec.sh +403 -0
  26. data/vendor/xspec-1.0.0/build.xml +369 -0
  27. data/vendor/xspec-1.0.0/editors/emacs/README +31 -0
  28. data/vendor/xspec-1.0.0/editors/emacs/schemas.xml +6 -0
  29. data/vendor/xspec-1.0.0/editors/oxygen/.cvsignore +2 -0
  30. data/vendor/xspec-1.0.0/editors/oxygen/README +11 -0
  31. data/vendor/xspec-1.0.0/editors/oxygen/build.xml +38 -0
  32. data/vendor/xspec-1.0.0/editors/oxygen/templates/xspec.xml +17 -0
  33. data/vendor/xspec-1.0.0/editors/oxygen/xspec.framework +175 -0
  34. data/vendor/xspec-1.0.0/find-examples.xml +37 -0
  35. data/vendor/xspec-1.0.0/find-examples.xsl +615 -0
  36. data/vendor/xspec-1.0.0/graphics/3angle-down.gif +0 -0
  37. data/vendor/xspec-1.0.0/graphics/3angle-right.gif +0 -0
  38. data/vendor/xspec-1.0.0/java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.class +0 -0
  39. data/vendor/xspec-1.0.0/java/com/jenitennison/xslt/tests/XSLTCoverageTraceListener.java +209 -0
  40. data/vendor/xspec-1.0.0/src/ant/find-test-failure.xsl +17 -0
  41. data/vendor/xspec-1.0.0/src/ant/get-schematron-phase.xsl +17 -0
  42. data/vendor/xspec-1.0.0/src/ant/locate-schematron.xsl +28 -0
  43. data/vendor/xspec-1.0.0/src/ant/make-path.js +4 -0
  44. data/vendor/xspec-1.0.0/src/compiler/generate-common-tests.xsl +604 -0
  45. data/vendor/xspec-1.0.0/src/compiler/generate-query-helper.xsl +152 -0
  46. data/vendor/xspec-1.0.0/src/compiler/generate-query-tests.xsl +473 -0
  47. data/vendor/xspec-1.0.0/src/compiler/generate-query-utils.xql +263 -0
  48. data/vendor/xspec-1.0.0/src/compiler/generate-tests-helper.xsl +169 -0
  49. data/vendor/xspec-1.0.0/src/compiler/generate-tests-utils.xsl +479 -0
  50. data/vendor/xspec-1.0.0/src/compiler/generate-xspec-tests.xsl +503 -0
  51. data/vendor/xspec-1.0.0/src/harnesses/basex/basex-standalone-xquery-harness.xproc +135 -0
  52. data/vendor/xspec-1.0.0/src/harnesses/basex/basex-xquery-harness.xproc +133 -0
  53. data/vendor/xspec-1.0.0/src/harnesses/exist/exist-xquery-harness.xproc +161 -0
  54. data/vendor/xspec-1.0.0/src/harnesses/harness-lib.xpl +327 -0
  55. data/vendor/xspec-1.0.0/src/harnesses/marklogic/ml-xquery-harness.xproc +143 -0
  56. data/vendor/xspec-1.0.0/src/harnesses/saxon/saxon-xquery-harness.xproc +108 -0
  57. data/vendor/xspec-1.0.0/src/harnesses/saxon/saxon-xslt-harness.xproc +85 -0
  58. data/vendor/xspec-1.0.0/src/harnesses/zorba/zorba-xquery-harness.xproc +134 -0
  59. data/vendor/xspec-1.0.0/src/reporter/coverage-report.xsl +378 -0
  60. data/vendor/xspec-1.0.0/src/reporter/format-utils.xsl +220 -0
  61. data/vendor/xspec-1.0.0/src/reporter/format-xspec-report-folding.xsl +164 -0
  62. data/vendor/xspec-1.0.0/src/reporter/format-xspec-report.xsl +410 -0
  63. data/vendor/xspec-1.0.0/src/reporter/junit-report.xsl +93 -0
  64. data/vendor/xspec-1.0.0/src/reporter/test-report.css +469 -0
  65. data/vendor/xspec-1.0.0/src/schemas/find-examples.rnc +90 -0
  66. data/vendor/xspec-1.0.0/src/schemas/xspec.rnc +304 -0
  67. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_abstract_expand.xsl +313 -0
  68. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_dsdl_include.xsl +1519 -0
  69. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_message.xsl +64 -0
  70. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_message_xslt2.xsl +64 -0
  71. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_skeleton_for_saxon.xsl +2306 -0
  72. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_schematron_skeleton_for_xslt1.xsl +1851 -0
  73. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_svrl_for_xslt1.xsl +614 -0
  74. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/iso_svrl_for_xslt2.xsl +692 -0
  75. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/readme.txt +101 -0
  76. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-cs.xhtml +56 -0
  77. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-de.xhtml +55 -0
  78. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-en.xhtml +57 -0
  79. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-fr.xhtml +54 -0
  80. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-ja.xhtml +53 -0
  81. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/sch-messages-nl.xhtml +58 -0
  82. data/vendor/xspec-1.0.0/src/schematron/iso-schematron/schematron-skeleton-api.htm +723 -0
  83. data/vendor/xspec-1.0.0/src/schematron/sch-location-compare.xsl +139 -0
  84. data/vendor/xspec-1.0.0/src/schematron/schut-to-xspec.xsl +179 -0
  85. data/vendor/xspec-1.0.0/test/Makefile +117 -0
  86. data/vendor/xspec-1.0.0/test/README +5 -0
  87. data/vendor/xspec-1.0.0/test/catalog/xspec-160_catalog.xml +4 -0
  88. data/vendor/xspec-1.0.0/test/catalog/xspec-160_schematron.xspec +6 -0
  89. data/vendor/xspec-1.0.0/test/catalog/xspec-160_xslt.xspec +5 -0
  90. data/vendor/xspec-1.0.0/test/end-to-end/README.md +42 -0
  91. data/vendor/xspec-1.0.0/test/end-to-end/cases/.gitignore +1 -0
  92. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/.gitignore +3 -0
  93. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-50-result-norm.html +74 -0
  94. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-55-result-norm.html +112 -0
  95. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-focus-1-result-norm.html +109 -0
  96. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-function-result-norm.html +118 -0
  97. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-import-result-norm.html +163 -0
  98. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-imported-result-norm.html +95 -0
  99. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-pending-result-norm.html +123 -0
  100. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-rule-result-norm.html +109 -0
  101. data/vendor/xspec-1.0.0/test/end-to-end/cases/expected/xspec-three-dots-result-norm.html +1237 -0
  102. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-50.xsl +7 -0
  103. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-50.xspec +10 -0
  104. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-55.xsl +2 -0
  105. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-55.xspec +18 -0
  106. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-focus-1.xspec +71 -0
  107. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-function.xspec +50 -0
  108. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-import.xspec +50 -0
  109. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-imported.xspec +48 -0
  110. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-pending.xspec +89 -0
  111. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-rule.xspec +76 -0
  112. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-three-dots.xsl +49 -0
  113. data/vendor/xspec-1.0.0/test/end-to-end/cases/xspec-three-dots.xspec +527 -0
  114. data/vendor/xspec-1.0.0/test/end-to-end/generate-expected.cmd +51 -0
  115. data/vendor/xspec-1.0.0/test/end-to-end/generate-expected.sh +25 -0
  116. data/vendor/xspec-1.0.0/test/end-to-end/processor/_deserializer.xsl +53 -0
  117. data/vendor/xspec-1.0.0/test/end-to-end/processor/_normalizer.xsl +192 -0
  118. data/vendor/xspec-1.0.0/test/end-to-end/processor/_serializer.xsl +15 -0
  119. data/vendor/xspec-1.0.0/test/end-to-end/processor/_util.xsl +35 -0
  120. data/vendor/xspec-1.0.0/test/end-to-end/processor/compare.xsl +88 -0
  121. data/vendor/xspec-1.0.0/test/end-to-end/processor/normalize.xsl +28 -0
  122. data/vendor/xspec-1.0.0/test/end-to-end/run-e2e-tests.cmd +61 -0
  123. data/vendor/xspec-1.0.0/test/end-to-end/run-e2e-tests.sh +28 -0
  124. data/vendor/xspec-1.0.0/test/generate-tests-utils.xspec +636 -0
  125. data/vendor/xspec-1.0.0/test/generate-x-utils.xspec +173 -0
  126. data/vendor/xspec-1.0.0/test/generate-xspec-tests.xspec +64 -0
  127. data/vendor/xspec-1.0.0/test/run-xspec-tests.cmd +83 -0
  128. data/vendor/xspec-1.0.0/test/run-xspec-tests.sh +42 -0
  129. data/vendor/xspec-1.0.0/test/sch-location-compare.xspec +179 -0
  130. data/vendor/xspec-1.0.0/test/schematron/data/standards.xml +7 -0
  131. data/vendor/xspec-1.0.0/test/schematron/schematron-017.sch +9 -0
  132. data/vendor/xspec-1.0.0/test/schematron/schematron-018.sch +17 -0
  133. data/vendor/xspec-1.0.0/test/schematron/schematron-019.sch +13 -0
  134. data/vendor/xspec-1.0.0/test/schematron/schematron-020-01.sch +35 -0
  135. data/vendor/xspec-1.0.0/test/schematron/schematron-020.sch +32 -0
  136. data/vendor/xspec-1.0.0/test/schematron/schematron-021.sch +28 -0
  137. data/vendor/xspec-1.0.0/test/schematron/schematron-022.sch +18 -0
  138. data/vendor/xspec-1.0.0/test/schematron/schematron-xslt-compile.xsl +8 -0
  139. data/vendor/xspec-1.0.0/test/schematron/schematron-xslt-expand.xsl +8 -0
  140. data/vendor/xspec-1.0.0/test/schematron/schematron-xslt-include.xsl +8 -0
  141. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-001-in.xspec +5 -0
  142. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-001-out.xspec +7 -0
  143. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-002-in.xspec +5 -0
  144. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-002-out.xspec +7 -0
  145. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-002.sch +4 -0
  146. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-003-in.xspec +7 -0
  147. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-003-out.xspec +9 -0
  148. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-004-in.xspec +20 -0
  149. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-004-out.xspec +22 -0
  150. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-005-in.xspec +6 -0
  151. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-005-out.xspec +8 -0
  152. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-006-in.xspec +11 -0
  153. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-006-out.xspec +13 -0
  154. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-007-in.xspec +7 -0
  155. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-007-out.xspec +9 -0
  156. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-007.xml +2 -0
  157. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-008-in.xspec +9 -0
  158. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-008-out.xspec +9 -0
  159. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-009-import-in.xspec +5 -0
  160. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-009-in.xspec +6 -0
  161. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-009-out.xspec +10 -0
  162. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-010-import.xspec +5 -0
  163. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-010-in.xspec +6 -0
  164. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-010-out.xspec +8 -0
  165. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-011-in.xspec +6 -0
  166. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-011-out.xspec +8 -0
  167. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-012-01.xml +4 -0
  168. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-012-02.xml +13 -0
  169. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-012-out.xspec +81 -0
  170. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-013-in.xspec +6 -0
  171. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-013-out.xspec +8 -0
  172. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-test.sch +4 -0
  173. data/vendor/xspec-1.0.0/test/schematron/schut-to-xspec-test.sch.xsl +4 -0
  174. data/vendor/xspec-1.0.0/test/schematron-01.sch +17 -0
  175. data/vendor/xspec-1.0.0/test/schematron-01.xml +14 -0
  176. data/vendor/xspec-1.0.0/test/schematron-01.xspec +14 -0
  177. data/vendor/xspec-1.0.0/test/schematron-012.xspec +83 -0
  178. data/vendor/xspec-1.0.0/test/schematron-014-01.xml +10 -0
  179. data/vendor/xspec-1.0.0/test/schematron-014.sch +16 -0
  180. data/vendor/xspec-1.0.0/test/schematron-014.xspec +11 -0
  181. data/vendor/xspec-1.0.0/test/schematron-015.sch +16 -0
  182. data/vendor/xspec-1.0.0/test/schematron-015.xspec +11 -0
  183. data/vendor/xspec-1.0.0/test/schematron-016.sch +19 -0
  184. data/vendor/xspec-1.0.0/test/schematron-016.xspec +171 -0
  185. data/vendor/xspec-1.0.0/test/schematron-017.xspec +26 -0
  186. data/vendor/xspec-1.0.0/test/schematron-018.xspec +120 -0
  187. data/vendor/xspec-1.0.0/test/schematron-019.xspec +16 -0
  188. data/vendor/xspec-1.0.0/test/schematron-020.xspec +53 -0
  189. data/vendor/xspec-1.0.0/test/schematron-021.xspec +27 -0
  190. data/vendor/xspec-1.0.0/test/schematron-022.xspec +15 -0
  191. data/vendor/xspec-1.0.0/test/schematron-param-001.xspec +50 -0
  192. data/vendor/xspec-1.0.0/test/schut-to-xspec-012.sch +27 -0
  193. data/vendor/xspec-1.0.0/test/schut-to-xspec.xspec +85 -0
  194. data/vendor/xspec-1.0.0/test/unit-expect-xsl.xspec +28 -0
  195. data/vendor/xspec-1.0.0/test/xspec-26.xsl +19 -0
  196. data/vendor/xspec-1.0.0/test/xspec-26.xspec +17 -0
  197. data/vendor/xspec-1.0.0/test/xspec-30.xml +2 -0
  198. data/vendor/xspec-1.0.0/test/xspec-30.xsl +6 -0
  199. data/vendor/xspec-1.0.0/test/xspec-30.xspec +8 -0
  200. data/vendor/xspec-1.0.0/test/xspec-33.xsl +7 -0
  201. data/vendor/xspec-1.0.0/test/xspec-33.xspec +15 -0
  202. data/vendor/xspec-1.0.0/test/xspec-46.xsl +7 -0
  203. data/vendor/xspec-1.0.0/test/xspec-46.xspec +9 -0
  204. data/vendor/xspec-1.0.0/test/xspec-72.xsl +13 -0
  205. data/vendor/xspec-1.0.0/test/xspec-72.xspec +19 -0
  206. data/vendor/xspec-1.0.0/test/xspec-bat.cmd +757 -0
  207. data/vendor/xspec-1.0.0/test/xspec-focus-2.xspec +91 -0
  208. data/vendor/xspec-1.0.0/test/xspec-junit.xspec +78 -0
  209. data/vendor/xspec-1.0.0/test/xspec-result-naming-collision.xml +1003 -0
  210. data/vendor/xspec-1.0.0/test/xspec-result-naming-collision.xslt +10 -0
  211. data/vendor/xspec-1.0.0/test/xspec-result-naming-collision.xspec +13 -0
  212. data/vendor/xspec-1.0.0/test/xspec-tested.xql +44 -0
  213. data/vendor/xspec-1.0.0/test/xspec-tested.xsl +64 -0
  214. data/vendor/xspec-1.0.0/test/xspec-variable.xml +3 -0
  215. data/vendor/xspec-1.0.0/test/xspec-variable.xspec +58 -0
  216. data/vendor/xspec-1.0.0/test/xspec-xslt3.xsl +13 -0
  217. data/vendor/xspec-1.0.0/test/xspec-xslt3.xspec +12 -0
  218. data/vendor/xspec-1.0.0/test/xspec.bats +420 -0
  219. data/vendor/xspec-1.0.0/tutorial/escape-for-regex.xslt +40 -0
  220. data/vendor/xspec-1.0.0/tutorial/escape-for-regex.xspec +75 -0
  221. data/vendor/xspec-1.0.0/tutorial/schematron/demo-01.sch +17 -0
  222. data/vendor/xspec-1.0.0/tutorial/schematron/demo-01.xml +11 -0
  223. data/vendor/xspec-1.0.0/tutorial/schematron/demo-01.xspec +14 -0
  224. data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-PhaseA.xspec +11 -0
  225. data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-PhaseB.xspec +12 -0
  226. data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-import1.xspec +10 -0
  227. data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-import2.xspec +8 -0
  228. data/vendor/xspec-1.0.0/tutorial/schematron/demo-02-import3.xspec +10 -0
  229. data/vendor/xspec-1.0.0/tutorial/schematron/demo-02.sch +58 -0
  230. data/vendor/xspec-1.0.0/tutorial/schematron/demo-02.xml +19 -0
  231. data/vendor/xspec-1.0.0/tutorial/schematron/demo-03-doc1.xml +6 -0
  232. data/vendor/xspec-1.0.0/tutorial/schematron/demo-03-doc2.xml +7 -0
  233. data/vendor/xspec-1.0.0/tutorial/schematron/demo-03.sch +29 -0
  234. data/vendor/xspec-1.0.0/tutorial/schematron/demo-03.xspec +63 -0
  235. data/vendor/xspec-1.0.0/tutorial/schematron/demo-04.sch +20 -0
  236. data/vendor/xspec-1.0.0/tutorial/schematron/demo-04.xspec +33 -0
  237. data/vendor/xspec-1.0.0/tutorial/schematron/quickfix.sch +81 -0
  238. data/vendor/xspec-1.0.0/tutorial/xquery-tutorial.xq +8 -0
  239. data/vendor/xspec-1.0.0/tutorial/xquery-tutorial.xspec +16 -0
  240. data/vendor/xspec-1.0.0/xproject/project.xml +8 -0
  241. data/vendor/xspec-1.0.0/xproject/release-project.xsl +41 -0
  242. metadata +341 -0
@@ -0,0 +1,757 @@
1
+ @echo off
2
+ if defined DEBUG @echo on
3
+
4
+ rem
5
+ rem Begin localization of environment changes.
6
+ rem Also make sure the command processor extensions are enabled.
7
+ rem
8
+ verify other 2> NUL
9
+ setlocal enableextensions
10
+ if errorlevel 1 (
11
+ echo Unable to enable extensions
12
+ exit /b %ERRORLEVEL%
13
+ )
14
+
15
+ rem
16
+ rem Results log file
17
+ rem
18
+ set RESULTS_FILE=%TEMP%\%~n0_results.log
19
+ call :del "%RESULTS_FILE%"
20
+
21
+ rem
22
+ rem Work directory
23
+ rem - Created at :setup
24
+ rem - Removed recursively at :teardown
25
+ rem
26
+ set WORK_DIR=%TEMP%\%~n0_work
27
+
28
+ rem
29
+ rem Output log files for :run
30
+ rem
31
+ set OUTPUT_RAW=%WORK_DIR%\run_raw.log
32
+ set OUTPUT_LINENUM=%WORK_DIR%\run_linenum.log
33
+
34
+ rem
35
+ rem Name and extension of this file
36
+ rem
37
+ set THIS_FILE_NX=%~nx0
38
+
39
+ rem
40
+ rem Go to the directory where this script resides
41
+ rem
42
+ pushd "%~dp0"
43
+
44
+ rem
45
+ rem Full path to the parent directory
46
+ rem
47
+ for %%I in (..) do set PARENT_DIR_ABS=%%~fI
48
+
49
+ echo === START TEST CASES ================================================
50
+
51
+ setlocal
52
+ call :setup "invoking xspec without arguments prints usage"
53
+
54
+ call :run ..\bin\xspec.bat
55
+ call :verify_retval 1
56
+ call :verify_line 3 x "Usage: xspec [-t|-q|-s|-c|-j|-h] filename [coverage]"
57
+
58
+ call :teardown
59
+ endlocal
60
+
61
+ setlocal
62
+ call :setup "invoking xspec with -s and -t prints error message"
63
+
64
+ call :run ..\bin\xspec.bat -s -t
65
+ call :verify_retval 1
66
+ call :verify_line 2 x "-s and -t are mutually exclusive"
67
+
68
+ call :teardown
69
+ endlocal
70
+
71
+ setlocal
72
+ call :setup "invoking xspec with -s and -q prints error message"
73
+
74
+ call :run ..\bin\xspec.bat -s -q
75
+ call :verify_retval 1
76
+ call :verify_line 2 x "-s and -q are mutually exclusive"
77
+
78
+ call :teardown
79
+ endlocal
80
+
81
+ setlocal
82
+ call :setup "invoking xspec with -t and -q prints error message"
83
+
84
+ call :run ..\bin\xspec.bat -t -q
85
+ call :verify_retval 1
86
+ call :verify_line 2 x "-t and -q are mutually exclusive"
87
+
88
+ call :teardown
89
+ endlocal
90
+
91
+ setlocal
92
+ call :setup "invoking code coverage with Saxon9HE returns error message"
93
+
94
+ set SAXON_CP=%SYSTEMDRIVE%\path\to\saxon9he.jar
95
+
96
+ call :run ..\bin\xspec.bat -c ..\tutorial\escape-for-regex.xspec
97
+ call :verify_retval 1
98
+ call :verify_line 2 x "Code coverage requires Saxon extension functions which are available only under Saxon9EE or Saxon9PE."
99
+
100
+ call :teardown
101
+ endlocal
102
+
103
+ setlocal
104
+ call :setup "invoking code coverage with Saxon9SA returns error message"
105
+
106
+ set SAXON_CP=%SYSTEMDRIVE%\path\to\saxon9sa.jar
107
+
108
+ call :run ..\bin\xspec.bat -c ..\tutorial\escape-for-regex.xspec
109
+ call :verify_retval 1
110
+ call :verify_line 2 x "Code coverage requires Saxon extension functions which are available only under Saxon9EE or Saxon9PE."
111
+
112
+ call :teardown
113
+ endlocal
114
+
115
+ setlocal
116
+ call :setup "invoking code coverage with Saxon9 returns error message"
117
+
118
+ set SAXON_CP=%SYSTEMDRIVE%\path\to\saxon9.jar
119
+
120
+ call :run ..\bin\xspec.bat -c ..\tutorial\escape-for-regex.xspec
121
+ call :verify_retval 1
122
+ call :verify_line 2 x "Code coverage requires Saxon extension functions which are available only under Saxon9EE or Saxon9PE."
123
+
124
+ call :teardown
125
+ endlocal
126
+
127
+ setlocal
128
+ call :setup "invoking code coverage with Saxon8SA returns error message"
129
+
130
+ set SAXON_CP=%SYSTEMDRIVE%\path\to\saxon8sa.jar
131
+
132
+ call :run ..\bin\xspec.bat -c ..\tutorial\escape-for-regex.xspec
133
+ call :verify_retval 1
134
+ call :verify_line 2 x "Code coverage requires Saxon extension functions which are available only under Saxon9EE or Saxon9PE."
135
+
136
+ call :teardown
137
+ endlocal
138
+
139
+ setlocal
140
+ call :setup "invoking code coverage with Saxon8 returns error message"
141
+
142
+ set SAXON_CP=%SYSTEMDRIVE%\path\to\saxon8.jar
143
+
144
+ call :run ..\bin\xspec.bat -c ..\tutorial\escape-for-regex.xspec
145
+ call :verify_retval 1
146
+ call :verify_line 2 x "Code coverage requires Saxon extension functions which are available only under Saxon9EE or Saxon9PE."
147
+
148
+ call :teardown
149
+ endlocal
150
+
151
+ setlocal
152
+ call :setup "invoking code coverage with Saxon9EE creates test stylesheet"
153
+
154
+ set SAXON_CP=%SYSTEMDRIVE%\path\to\saxon9ee.jar
155
+
156
+ call :run ..\bin\xspec.bat -c ..\tutorial\escape-for-regex.xspec
157
+ call :verify_retval 1
158
+ call :verify_line 2 x "Creating Test Stylesheet..."
159
+
160
+ call :teardown
161
+ endlocal
162
+
163
+ setlocal
164
+ call :setup "invoking code coverage with Saxon9PE creates test stylesheet"
165
+
166
+ set SAXON_CP=%SYSTEMDRIVE%\path\to\saxon9pe.jar
167
+
168
+ call :run ..\bin\xspec.bat -c ..\tutorial\escape-for-regex.xspec
169
+ call :verify_retval 1
170
+ call :verify_line 2 x "Creating Test Stylesheet..."
171
+
172
+ call :teardown
173
+ endlocal
174
+
175
+ setlocal
176
+ call :setup "invoking xspec generates XML report file"
177
+
178
+ call :run ..\bin\xspec.bat ..\tutorial\escape-for-regex.xspec
179
+ call :verify_exist ..\tutorial\xspec\escape-for-regex-result.xml
180
+
181
+ call :teardown
182
+ endlocal
183
+
184
+ setlocal
185
+ call :setup "invoking xspec generates HTML report file"
186
+
187
+ call :run ..\bin\xspec.bat ..\tutorial\escape-for-regex.xspec
188
+ call :verify_exist ..\tutorial\xspec\escape-for-regex-result.html
189
+
190
+ call :teardown
191
+ endlocal
192
+
193
+ setlocal
194
+ call :setup "invoking xspec with -j option with Saxon8 returns error message"
195
+
196
+ set SAXON_CP=%SYSTEMDRIVE%\path\to\saxon8.jar
197
+
198
+ call :run ..\bin\xspec.bat -j ..\tutorial\escape-for-regex.xspec
199
+ call :verify_retval 1
200
+ call :verify_line 2 x "Saxon8 detected. JUnit report requires Saxon9."
201
+
202
+ call :teardown
203
+ endlocal
204
+
205
+ setlocal
206
+ call :setup "invoking xspec with -j option with Saxon8-SA returns error message"
207
+
208
+ set SAXON_CP=%SYSTEMDRIVE%\path\to\saxon8sa.jar
209
+
210
+ call :run ..\bin\xspec.bat -j ..\tutorial\escape-for-regex.xspec
211
+ call :verify_retval 1
212
+ call :verify_line 2 x "Saxon8 detected. JUnit report requires Saxon9."
213
+
214
+ call :teardown
215
+ endlocal
216
+
217
+ setlocal
218
+ call :setup "invoking xspec with -j option generates message with JUnit report location"
219
+
220
+ call :run ..\bin\xspec.bat -j ..\tutorial\escape-for-regex.xspec
221
+ call :verify_retval 0
222
+ call :verify_line 19 x "Report available at %PARENT_DIR_ABS%\tutorial\xspec\escape-for-regex-junit.xml"
223
+
224
+ call :teardown
225
+ endlocal
226
+
227
+ setlocal
228
+ call :setup "invoking xspec with -j option generates XML report file"
229
+
230
+ call :run ..\bin\xspec.bat -j ..\tutorial\escape-for-regex.xspec
231
+ call :verify_exist ..\tutorial\xspec\escape-for-regex-result.xml
232
+
233
+ call :teardown
234
+ endlocal
235
+
236
+ setlocal
237
+ call :setup "invoking xspec with -j option generates JUnit report file"
238
+
239
+ call :run ..\bin\xspec.bat -j ..\tutorial\escape-for-regex.xspec
240
+ call :verify_exist ..\tutorial\xspec\escape-for-regex-junit.xml
241
+
242
+ call :teardown
243
+ endlocal
244
+
245
+ setlocal
246
+ call :setup "invoking xspec with Saxon-B-9-1-0-8 creates test stylesheet"
247
+
248
+ set SAXON_CP=%SYSTEMDRIVE%\path\to\saxonb9-1-0-8.jar
249
+
250
+ call :run ..\bin\xspec.bat ..\tutorial\escape-for-regex.xspec
251
+ call :verify_retval 1
252
+ call :verify_line 2 x "Creating Test Stylesheet..."
253
+
254
+ call :teardown
255
+ endlocal
256
+
257
+ setlocal
258
+ call :setup "invoking xspec.bat with TEST_DIR already set externally generates files inside TEST_DIR"
259
+
260
+ set TEST_DIR=%WORK_DIR%
261
+
262
+ call :run ..\bin\xspec.bat ..\tutorial\escape-for-regex.xspec
263
+ call :verify_retval 0
264
+ call :verify_line 19 x "Report available at %TEST_DIR%\escape-for-regex-result.html"
265
+
266
+ call :teardown
267
+ endlocal
268
+
269
+ setlocal
270
+ call :setup "invoking xspec.bat without TEST_DIR generates files in default location"
271
+
272
+ call :run ..\bin\xspec.bat ..\tutorial\escape-for-regex.xspec
273
+ call :verify_retval 0
274
+ call :verify_line 19 x "Report available at %PARENT_DIR_ABS%\tutorial\xspec\escape-for-regex-result.html"
275
+
276
+ call :teardown
277
+ endlocal
278
+
279
+ setlocal
280
+ call :setup "invoking xspec.bat that passes a non xs:boolean does not raise a warning #46"
281
+
282
+ call :run ..\bin\xspec.bat ..\test\xspec-46.xspec
283
+ call :verify_retval 0
284
+ call :verify_line 4 r "Testing with"
285
+
286
+ call :teardown
287
+ endlocal
288
+
289
+ setlocal
290
+ call :setup "executing the Saxon XProc harness generates a report with UTF-8 encoding"
291
+
292
+ if defined XMLCALABASH_CP (
293
+ call :run java -Xmx1024m -cp "%XMLCALABASH_CP%" com.xmlcalabash.drivers.Main -isource=xspec-72.xspec -p xspec-home="file:/%PARENT_DIR_ABS:\=/%/" -oresult=xspec/xspec-72-result.html ..\src\harnesses\saxon\saxon-xslt-harness.xproc
294
+ call :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
295
+ call :verify_line 1 x "true"
296
+ ) else (
297
+ call :skip "test for XProc skipped as XMLCalabash uses a higher version of Saxon"
298
+ )
299
+
300
+ call :teardown
301
+ endlocal
302
+
303
+ setlocal
304
+ call :setup "invoking xspec.bat for parentheses dir generates HTML report file #84"
305
+
306
+ set PARENTHESES_DIR=%WORK_DIR%\%~n0 (84)
307
+ call :mkdir "%PARENTHESES_DIR%"
308
+ copy ..\tutorial\escape-for-regex.* "%PARENTHESES_DIR%" > NUL
309
+
310
+ set EXPECTED_REPORT=%PARENTHESES_DIR%\xspec\escape-for-regex-result.html
311
+
312
+ call :run ..\bin\xspec.bat "%PARENTHESES_DIR%\escape-for-regex.xspec"
313
+ call :verify_retval 0
314
+ call :verify_line 20 x "Report available at %EXPECTED_REPORT%"
315
+ call :verify_exist "%EXPECTED_REPORT%"
316
+
317
+ call :teardown
318
+ endlocal
319
+
320
+ setlocal
321
+ call :setup "invoking xspec.bat with path containing an apostrophe runs successfully #119"
322
+
323
+ set APOSTROPHE_DIR=%WORK_DIR%\some'path
324
+ call :mkdir "%APOSTROPHE_DIR%"
325
+ copy ..\tutorial\escape-for-regex.* "%APOSTROPHE_DIR%" > NUL
326
+
327
+ call :run ..\bin\xspec.bat "%APOSTROPHE_DIR%\escape-for-regex.xspec"
328
+ call :verify_retval 0
329
+ call :verify_line 20 x "Report available at %APOSTROPHE_DIR%\xspec\escape-for-regex-result.html"
330
+
331
+ call :teardown
332
+ endlocal
333
+
334
+ setlocal
335
+ call :setup "Schematron phase/parameters are passed to Schematron compile"
336
+
337
+ call :run ..\bin\xspec.bat -s ..\test\schematron-param-001.xspec
338
+ call :verify_retval 0
339
+ call :verify_line 3 x "Paramaters: phase=P1 ?selected=codepoints-to-string((80,49))"
340
+
341
+ call :teardown
342
+ endlocal
343
+
344
+ setlocal
345
+ call :setup "invoking xspec with Schematron XSLTs provided externally uses provided XSLTs for Schematron compile"
346
+
347
+ set SCHEMATRON_XSLT_INCLUDE=schematron\schematron-xslt-include.xsl
348
+ set SCHEMATRON_XSLT_EXPAND=schematron\schematron-xslt-expand.xsl
349
+ set SCHEMATRON_XSLT_COMPILE=schematron\schematron-xslt-compile.xsl
350
+
351
+ call :run ..\bin\xspec.bat -s ..\tutorial\schematron\demo-01.xspec
352
+ call :verify_line 5 x "Schematron XSLT include"
353
+ call :verify_line 6 x "Schematron XSLT expand"
354
+ call :verify_line 7 x "Schematron XSLT compile"
355
+
356
+ call :teardown
357
+ endlocal
358
+
359
+ setlocal
360
+ call :setup "invoking xspec.bat with the -s option does not display Schematron warnings #129 #131"
361
+
362
+ call :run ..\bin\xspec.bat -s ..\tutorial\schematron\demo-01.xspec
363
+ call :verify_retval 0
364
+ call :verify_line 5 x "Compiling the Schematron tests..."
365
+
366
+ call :teardown
367
+ endlocal
368
+
369
+ setlocal
370
+ call :setup "Cleanup removes temporary files"
371
+
372
+ call :run ..\bin\xspec.bat -s ..\tutorial\schematron\demo-03.xspec
373
+ call :verify_retval 0
374
+ call :verify_not_exist ..\tutorial\schematron\demo-03.xspec-compiled.xspec
375
+ call :run dir /on ..\tutorial\schematron\xspec
376
+ call :verify_line 9 r ".*3 File.*"
377
+ call :verify_exist ..\tutorial\schematron\xspec\demo-03-result.html
378
+ call :verify_exist ..\tutorial\schematron\xspec\demo-03-result.xml
379
+ call :verify_exist ..\tutorial\schematron\xspec\demo-03.xsl
380
+
381
+ call :teardown
382
+ endlocal
383
+
384
+ setlocal
385
+ call :setup "HTML report contains CSS inline and not as an external file #135"
386
+
387
+ call :run ..\bin\xspec.bat ..\tutorial\escape-for-regex.xspec
388
+ call :run java -cp "%SAXON_CP%" net.sf.saxon.Query -s:..\tutorial\xspec\escape-for-regex-result.html -qs:"declare default element namespace 'http://www.w3.org/1999/xhtml'; concat(/html/head[not(link[@type = 'text/css'])]/style[@type = 'text/css']/contains(., 'margin-right:'), '
')" !method=text
389
+ call :verify_line 1 x "true"
390
+
391
+ call :teardown
392
+ endlocal
393
+
394
+ setlocal
395
+ call :setup "Ant for XSLT with default properties fails on test failure"
396
+
397
+ if defined ANT_VERSION (
398
+ call :run ant -buildfile "%CD%\..\build.xml" -Dxspec.xml="%CD%\..\tutorial\escape-for-regex.xspec" -lib "%SAXON_CP%"
399
+ call :verify_retval 1
400
+ call :verify_line -4 x "BUILD FAILED"
401
+ ) else (
402
+ call :skip "test for XSLT Ant with default properties skipped"
403
+ )
404
+
405
+ call :teardown
406
+ endlocal
407
+
408
+ setlocal
409
+ call :setup "Ant for XSLT with xspec.fail=false continues on test failure"
410
+
411
+ if defined ANT_VERSION (
412
+ call :run ant -buildfile "%CD%\..\build.xml" -Dxspec.xml="%CD%\..\tutorial\escape-for-regex.xspec" -lib "%SAXON_CP%" -Dxspec.fail=false
413
+ call :verify_retval 0
414
+ call :verify_line -2 x "BUILD SUCCESSFUL"
415
+ ) else (
416
+ call :skip "test for XSLT Ant with xspec.fail=false skipped"
417
+ )
418
+
419
+ call :teardown
420
+ endlocal
421
+
422
+ setlocal
423
+ call :setup "Ant for XSLT with catalog resolves URI"
424
+
425
+ if defined ANT_VERSION (
426
+ call :run ant -buildfile "%CD%\..\build.xml" -Dxspec.xml="%CD%\catalog\xspec-160_xslt.xspec" -lib "%SAXON_CP%" -Dxspec.fail=false -Dcatalog="%CD%\catalog\xspec-160_catalog.xml" -lib "%XML_RESOLVER_CP%"
427
+ call :verify_retval 0
428
+ call :verify_line -2 x "BUILD SUCCESSFUL"
429
+ ) else (
430
+ call :skip "test for XSLT Ant with catalog skipped"
431
+ )
432
+
433
+ call :teardown
434
+ endlocal
435
+
436
+ setlocal
437
+ call :setup "Ant for Schematron with minimum properties"
438
+
439
+ if defined ANT_VERSION (
440
+ call :run ant -buildfile "%CD%\..\build.xml" -Dxspec.xml="%CD%\..\tutorial\schematron\demo-02-PhaseA.xspec" -lib "%SAXON_CP%" -Dtest.type=s
441
+ call :verify_retval 0
442
+ call :verify_line -2 x "BUILD SUCCESSFUL"
443
+
444
+ rem Verify default clean.output.dir is false
445
+ call :verify_exist ..\tutorial\schematron\xspec\
446
+ call :verify_exist ..\tutorial\schematron\demo-02-PhaseA.xspec-compiled.xspec
447
+ call :verify_exist ..\tutorial\schematron\demo-02.sch-compiled.xsl
448
+
449
+ rem Delete temp file
450
+ call :del ..\tutorial\schematron\demo-02-PhaseA.xspec-compiled.xspec
451
+ call :del ..\tutorial\schematron\demo-02.sch-compiled.xsl
452
+ ) else (
453
+ call :skip "test for Schematron Ant with minimum properties skipped"
454
+ )
455
+
456
+ call :teardown
457
+ endlocal
458
+
459
+ setlocal
460
+ call :setup "Ant for Schematron with various properties except catalog"
461
+
462
+ set BUILD_XML=%WORK_DIR%\build.xml
463
+
464
+ if defined ANT_VERSION (
465
+ rem Remove a temp dir created by setup
466
+ call :rmdir ..\tutorial\schematron\xspec
467
+
468
+ rem For testing -Dxspec.project.dir
469
+ copy ..\build.xml "%BUILD_XML%" > NUL
470
+
471
+ call :run ant -buildfile "%BUILD_XML%" -Dxspec.xml="%CD%\..\tutorial\schematron\demo-03.xspec" -lib "%SAXON_CP%" -Dtest.type=s -Dxspec.project.dir="%CD%\.." -Dxspec.phase=#ALL -Dxspec.dir="%CD%\xspec-temp" -Dclean.output.dir=true
472
+ call :verify_retval 0
473
+ call :verify_line -2 x "BUILD SUCCESSFUL"
474
+
475
+ rem Verify that -Dxspec-dir was honered and the default dir was not created
476
+ call :verify_not_exist ..\tutorial\schematron\xspec\
477
+
478
+ rem Verify clean.output.dir=true
479
+ call :verify_not_exist xspec-temp\
480
+ call :verify_not_exist ..\tutorial\schematron\demo-03.xspec-compiled.xspec
481
+ call :verify_not_exist ..\tutorial\schematron\demo-03.sch-compiled.xsl
482
+ ) else (
483
+ call :skip "test for Schematron Ant with various properties except catalog skipped"
484
+ )
485
+
486
+ call :teardown
487
+ endlocal
488
+
489
+ setlocal
490
+ call :setup "Ant for Schematron with catalog and default xspec.fail fails on test failure"
491
+
492
+ if defined ANT_VERSION (
493
+ call :run ant -buildfile "%CD%\..\build.xml" -Dxspec.xml="%CD%\catalog\xspec-160_schematron.xspec" -lib "%SAXON_CP%" -Dtest.type=s -Dxspec.phase=#ALL -Dclean.output.dir=true -Dcatalog="%CD%\catalog\xspec-160_catalog.xml" -lib "%XML_RESOLVER_CP%"
494
+ call :verify_retval 1
495
+ call :verify_line -4 x "BUILD FAILED"
496
+
497
+ rem Verify the build fails before cleanup
498
+ call :verify_exist catalog\xspec\
499
+
500
+ rem Verify the build fails after Schematron setup
501
+ call :verify_exist catalog\xspec-160_schematron.xspec-compiled.xspec
502
+ call :verify_exist ..\tutorial\schematron\demo-04.sch-compiled.xsl
503
+
504
+ rem Delete temp file
505
+ call :del catalog\xspec-160_schematron.xspec-compiled.xspec
506
+ call :del ..\tutorial\schematron\demo-04.sch-compiled.xsl
507
+ ) else (
508
+ call :skip "test for Schematron Ant with catalog and default xspec.fail skipped"
509
+ )
510
+
511
+ call :teardown
512
+ endlocal
513
+
514
+ setlocal
515
+ call :setup "Ant for Schematron with catalog and xspec.fail=false continues on test failure"
516
+
517
+ if defined ANT_VERSION (
518
+ call :run ant -buildfile "%CD%\..\build.xml" -Dxspec.xml="%CD%\catalog\xspec-160_schematron.xspec" -lib "%SAXON_CP%" -Dtest.type=s -Dxspec.phase=#ALL -Dclean.output.dir=true -Dcatalog="%CD%\catalog\xspec-160_catalog.xml" -lib "%XML_RESOLVER_CP%" -Dxspec.fail=false
519
+ call :verify_retval 0
520
+ call :verify_line -2 x "BUILD SUCCESSFUL"
521
+ ) else (
522
+ call :skip "test for Schematron Ant with catalog and xspec.fail=false skipped"
523
+ )
524
+
525
+ call :teardown
526
+ endlocal
527
+
528
+ echo === END TEST CASES ==================================================
529
+
530
+ rem
531
+ rem Go back to the initial directory
532
+ rem
533
+ popd
534
+
535
+ rem
536
+ rem Retrieve the results and determine the exit code
537
+ rem
538
+ for /f "usebackq eol=# delims=" %%I in ("%RESULTS_FILE%") do if %%I EQU 0 set EXIT_CODE=%%I
539
+ for /f "usebackq eol=# delims=" %%I in ("%RESULTS_FILE%") do if %%I NEQ 0 set EXIT_CODE=%%I
540
+ if not defined EXIT_CODE (
541
+ echo No test cases performed!
542
+ set EXIT_CODE=1
543
+ )
544
+ if %EXIT_CODE% NEQ 0 (
545
+ echo ---------- %RESULTS_FILE%
546
+ type "%RESULTS_FILE%"
547
+ echo ----------
548
+ )
549
+ call :del "%RESULTS_FILE%"
550
+
551
+ rem
552
+ rem Exit
553
+ rem
554
+ echo EXIT_CODE=%EXIT_CODE%
555
+ exit /b %EXIT_CODE%
556
+
557
+ rem
558
+ rem Subroutines
559
+ rem
560
+
561
+ :del
562
+ if exist %1 (
563
+ del /q %1
564
+ if errorlevel 1 call :failed "Failed to del: %~1"
565
+ )
566
+ goto :EOF
567
+
568
+ :mkdir
569
+ mkdir %1
570
+ if errorlevel 1 call :failed "Failed to mkdir: %~1"
571
+ goto :EOF
572
+
573
+ :rmdir
574
+ if exist %1 (
575
+ call :del "%~1\*"
576
+ rmdir %1
577
+ if errorlevel 1 call :failed "Failed to rmdir: %~1"
578
+ )
579
+ goto :EOF
580
+
581
+ :rmdir-s
582
+ if exist %1 (
583
+ rmdir /s /q %1
584
+ if errorlevel 1 call :failed "Failed to rmdir /s: %~1"
585
+ )
586
+ goto :EOF
587
+
588
+ :appveyor
589
+ if /i "%APPVEYOR%"=="True" appveyor %*
590
+ goto :EOF
591
+
592
+ :setup
593
+ rem
594
+ rem Report 'Running'
595
+ rem
596
+ set CASE_NAME=%~1
597
+ call :appveyor AddTest "%CASE_NAME%" -Framework custom -Filename "%THIS_FILE_NX%" -Outcome Running
598
+ echo CASE: %CASE_NAME%
599
+ (echo # %CASE_NAME%) >> "%RESULTS_FILE%"
600
+
601
+ rem
602
+ rem Create the work directory
603
+ rem
604
+ call :mkdir "%WORK_DIR%"
605
+
606
+ rem
607
+ rem Create the XSpec output directories
608
+ rem
609
+ call :mkdir ..\test\xspec
610
+ call :mkdir ..\tutorial\xspec
611
+ call :mkdir ..\tutorial\schematron\xspec
612
+
613
+ goto :EOF
614
+
615
+ :teardown
616
+ rem
617
+ rem Remove the XSpec output directories
618
+ rem
619
+ call :rmdir ..\test\xspec
620
+ call :rmdir ..\tutorial\xspec
621
+ call :rmdir ..\tutorial\schematron\xspec
622
+
623
+ rem
624
+ rem Remove the work directory
625
+ rem
626
+ call :rmdir-s "%WORK_DIR%"
627
+
628
+ rem
629
+ rem Report 'Passed'
630
+ rem
631
+ if %CASE_RESULT% EQU 0 (
632
+ echo ...PASS
633
+ (echo %CASE_RESULT%) >> "%RESULTS_FILE%"
634
+ call :appveyor UpdateTest "%CASE_NAME%" -Framework custom -Filename "%THIS_FILE_NX%" -Outcome Passed -Duration 0
635
+ )
636
+ goto :EOF
637
+
638
+ :verified
639
+ echo ...Verified: %~1
640
+ if not defined CASE_RESULT set CASE_RESULT=0
641
+ goto :EOF
642
+
643
+ :failed
644
+ echo ...FAIL: %~1
645
+ set CASE_RESULT=1
646
+ (echo %CASE_RESULT%) >> "%RESULTS_FILE%"
647
+ if defined CASE_NAME call :appveyor UpdateTest "%CASE_NAME%" -Framework custom -Filename "%THIS_FILE_NX%" -Outcome Failed -Duration 0 -ErrorMessage %1
648
+ goto :EOF
649
+
650
+ :skip
651
+ echo ...SKIP: %~1
652
+ set CASE_RESULT=2
653
+ (echo # %~1) >> "%RESULTS_FILE%"
654
+ call :appveyor UpdateTest "%CASE_NAME%" -Framework custom -Filename "%THIS_FILE_NX%" -Outcome Skipped -Duration 0
655
+ goto :EOF
656
+
657
+ :run
658
+ rem
659
+ rem Executes the specified command line.
660
+ rem Saves stdout and stderr in a single file.
661
+ rem Saves the return value in RETVAL.
662
+ rem
663
+
664
+ rem
665
+ rem Print parameters and env vars
666
+ rem
667
+ echo ...%0 @ %TIME%: %*
668
+ rem set SAXON_
669
+ rem set TEST_
670
+ rem set XSPEC
671
+
672
+ rem
673
+ rem Run
674
+ rem
675
+ "%COMSPEC%" /c %* > "%OUTPUT_RAW%" 2>&1
676
+ set RETVAL=%ERRORLEVEL%
677
+
678
+ rem
679
+ rem Remove the JAVA_TOOL_OPTIONS output, to keep the line numbers predictable.
680
+ rem Remove the empty lines, to be compatible with Bats $lines.
681
+ rem Prefix each line with its line number.
682
+ rem
683
+ findstr /b /l /v /c:"Picked up JAVA_TOOL_OPTIONS:" "%OUTPUT_RAW%" | findstr /r /v /c:"^$" | find /v /n "" > "%OUTPUT_LINENUM%"
684
+
685
+ goto :EOF
686
+
687
+ :verify_retval
688
+ if %RETVAL% EQU %1 (
689
+ call :verified "Return value: %RETVAL%"
690
+ ) else (
691
+ call :failed "Return value is %RETVAL%. Expected %~1."
692
+ echo ---------- %OUTPUT_RAW%
693
+ type "%OUTPUT_RAW%"
694
+ echo ----------
695
+ )
696
+ goto :EOF
697
+
698
+ :verify_line
699
+ if defined DEBUG (
700
+ echo *: %*
701
+ echo 0: %0
702
+ echo 1: %1
703
+ echo 2: %2
704
+ echo 3: %3
705
+ )
706
+ rem
707
+ rem Checks to see if the specified line of the output log file matches exactly the specified string
708
+ rem
709
+ rem Parameters:
710
+ rem 1: Line number. Starts with 1, unlike Bats $lines which starts with 0.
711
+ rem Negative values indicate the reverse order. -1 is the last line. -2 is the line before the last line, and so on.
712
+ rem 2: Operator
713
+ rem x : Exact match ("=" on Bats)
714
+ rem r : Compare with regular expression ("=~" on Bats)
715
+ rem 3: Expected string
716
+ rem For 'r' operator, always evaluated as if the expression started with "^".
717
+ rem
718
+
719
+ set LINE_NUMBER=%~1
720
+ if %LINE_NUMBER% LSS 0 for /f %%I in ('type "%OUTPUT_LINENUM%" ^| find /v /c ""') do set /a LINE_NUMBER+=%%I+1
721
+
722
+ rem
723
+ rem Search the line-numbered output log file
724
+ rem
725
+ if /i "%~2"=="x" (
726
+ findstr /l /x /c:"[%LINE_NUMBER%]%~3" "%OUTPUT_LINENUM%" > NUL
727
+ ) else if /i "%~2"=="r" (
728
+ findstr /b /r /c:"\[%LINE_NUMBER%\]%~3" "%OUTPUT_LINENUM%" > NUL
729
+ ) else (
730
+ call :failed "Bad operator: %~2"
731
+ goto :EOF
732
+ )
733
+ if errorlevel 1 (
734
+ call :failed "Line %LINE_NUMBER% does not match the expected string"
735
+ echo ---------- %OUTPUT_LINENUM%
736
+ type "%OUTPUT_LINENUM%"
737
+ echo ----------
738
+ ) else (
739
+ call :verified "Line %LINE_NUMBER%"
740
+ )
741
+ goto :EOF
742
+
743
+ :verify_exist
744
+ if exist %1 (
745
+ call :verified "Exist: %~1"
746
+ ) else (
747
+ call :failed "Not exist: %~1"
748
+ )
749
+ goto :EOF
750
+
751
+ :verify_not_exist
752
+ if exist %1 (
753
+ call :failed "Exist: %~1"
754
+ ) else (
755
+ call :verified "Not exist: %~1"
756
+ )
757
+ goto :EOF