Skip to content

Commit

Permalink
XSLT test for #423 (Runtime source document should be removed) (XProc) (
Browse files Browse the repository at this point in the history
  • Loading branch information
AirQuick committed Apr 12, 2019
1 parent 2cf339d commit ce63744
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/win-bats/collection.xml
Expand Up @@ -655,4 +655,14 @@
call :verify_line * x "x:space is deprecated. Use x:text instead."
call :verify_line -1 x "*** Error compiling the test suite"
</case>

<case ifdef="XMLCALABASH_JAR" name="XSLT selecting nodes without context should be error (XProc) #423">
call :run java -jar "%XMLCALABASH_JAR%" ^
-i source=xspec-423/test.xspec ^
-p xspec-home="file:///%PARENT_DIR_ABS:\=/%/" ^
..\src\harnesses\saxon\saxon-xslt-harness.xproc
call :verify_retval 1
call :verify_line -3 r "..*:err:XPDY0002:"
call :verify_line -1 r "ERROR:"
</case>
</collection>
11 changes: 11 additions & 0 deletions test/xspec-423/test.xspec
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<x:description stylesheet="../do-nothing.xsl" xmlns:x="http://www.jenitennison.com/xslt/xspec">
<x:scenario>
<x:label>Suppose you're testing count() function with child::element() selected but you
forget to provide the selection context (either inner XML or @href)</x:label>
<x:call function="count">
<x:param select="child::element()" />
</x:call>
<x:expect label="and you happen to expect 1" select="1" />
</x:scenario>
</x:description>
16 changes: 16 additions & 0 deletions test/xspec.bats
Expand Up @@ -890,3 +890,19 @@ teardown() {
}


@test "XSLT selecting nodes without context should be error (XProc) #423" {
if [ -z "${XMLCALABASH_JAR}" ]; then
skip "XMLCALABASH_JAR is not defined"
fi

run java -jar "${XMLCALABASH_JAR}" \
-i source=xspec-423/test.xspec \
-p xspec-home="file:${PWD}/../" \
../src/harnesses/saxon/saxon-xslt-harness.xproc
echo "$output"
[ "$status" -eq 1 ]
[[ "${lines[${#lines[@]}-3]}" =~ ":err:XPDY0002:" ]]
[[ "${lines[${#lines[@]}-1]}" =~ "ERROR:" ]]
}


0 comments on commit ce63744

Please sign in to comment.