Skip to content

Commit

Permalink
remove old references to google repos expath#56 (expath#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandro Cirulli authored Jan 14, 2017
1 parent a6bb235 commit 33684b7
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 69 deletions.
1 change: 0 additions & 1 deletion bin/xspec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ die() {
# script for Saxon [1]. If it is present, that means the user already
# configured it, so there is no point to duplicate the logic here.
# Just use it.
# [1]http://code.google.com/p/expath-pkg/source/browse/trunk/saxon/pkg-saxon/src/shell/saxon

if which saxon > /dev/null 2>&1; then
echo Saxon script found, use it.
Expand Down
123 changes: 55 additions & 68 deletions tutorial/escape-for-regex.xspec
Original file line number Diff line number Diff line change
@@ -1,88 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>

<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec"
xmlns:functx="http://www.functx.com"
stylesheet="escape-for-regex.xslt">

<!--
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" xmlns:functx="http://www.functx.com" stylesheet="escape-for-regex.xslt">
<!--
This is a sample test suite written in the XSpec language. It
tests the stylesheet escape-for-regex.xslt. It contains three
main scenarios (the second of which in turn contains two sub-
scenarios).
See http://code.google.com/p/xspec/wiki/GettingStarted for the
See https://github.com/xspec/xspec/wiki/Getting-Started for the
full tutorial it is part of.
-->

<!--
<!--
This is a very simple scenario, checking the return value of a
function call (the param does not contain any character to be
escaped).
-->
<x:scenario label="No escaping">
<!-- call the function with the string 'Hello' -->
<x:call function="functx:escape-for-regex">
<x:param select="'Hello'"/>
</x:call>
<!-- check the result -->
<x:expect label="Must not be escaped at all" select="'Hello'"/>
</x:scenario>

<!--
<x:scenario label="No escaping">
<!-- call the function with the string 'Hello' -->
<x:call function="functx:escape-for-regex">
<x:param select="'Hello'"/>
</x:call>
<!-- check the result -->
<x:expect label="Must not be escaped at all" select="'Hello'"/>
</x:scenario>
<!--
This scenario demonstrates:
(1) how to test a function (named templates can be simliarly tested)
(2) that scenarios can be nested
(3) a test can have multiple expectations.
-->
<x:scenario label="Test simple patterns">

<!-- first sub-scenario -->
<x:scenario label="When encountering parentheses">
<!-- call the function -->
<x:call function="functx:escape-for-regex">
<x:param name="arg" select="'(Hello)'"/>
</x:call>
<!-- check the result -->
<x:expect label="escape them." select="'\(Hello\)'"/>
</x:scenario>

<!-- second sub-scenario -->
<x:scenario label="When encountering a whitespace character class">
<!-- call the function with another parameter -->
<x:call function="functx:escape-for-regex">
<x:param name="arg" select="'\sHello'"/>
</x:call>
<!-- check the result -->
<x:expect label="escape the backslash" select="'\\sHello'"/>
<!-- we can have several checks on the same result -->
<x:expect label="result should have one more character than source"
test="string-length(.) = 8"/>
</x:scenario>

</x:scenario>

<!--
<x:scenario label="Test simple patterns">
<!-- first sub-scenario -->
<x:scenario label="When encountering parentheses">
<!-- call the function -->
<x:call function="functx:escape-for-regex">
<x:param name="arg" select="'(Hello)'"/>
</x:call>
<!-- check the result -->
<x:expect label="escape them." select="'\(Hello\)'"/>
</x:scenario>
<!-- second sub-scenario -->
<x:scenario label="When encountering a whitespace character class">
<!-- call the function with another parameter -->
<x:call function="functx:escape-for-regex">
<x:param name="arg" select="'\sHello'"/>
</x:call>
<!-- check the result -->
<x:expect label="escape the backslash" select="'\\sHello'"/>
<!-- we can have several checks on the same result -->
<x:expect label="result should have one more character than source" test="string-length(.) = 8"/>
</x:scenario>
</x:scenario>
<!--
This scenario demonstrates how to test a matching template.
-->
<x:scenario label="When processing a list of phrases">
<!-- apply template rules to this element -->
<x:context>
<phrases>
<phrase>Hello!</phrase>
<phrase>Goodbye!</phrase>
<phrase>(So long!)</phrase>
</phrases>
</x:context>
<!-- check the result -->
<x:expect label="All phrase elements should remain"
test="count(phrases/phrase) = 3"/>
<x:expect label="Strings should be escaped and status attributes should be added">
<phrases>
<phrase status="same">Hello!</phrase>
<phrase status="same">Goodbye!</phrase>
<phrase status="changed">\(So long!\)</phrase>
</phrases>
</x:expect>
</x:scenario>

<x:scenario label="When processing a list of phrases">
<!-- apply template rules to this element -->
<x:context>
<phrases>
<phrase>Hello!</phrase>
<phrase>Goodbye!</phrase>
<phrase>(So long!)</phrase>
</phrases>
</x:context>
<!-- check the result -->
<x:expect label="All phrase elements should remain" test="count(phrases/phrase) = 3"/>
<x:expect label="Strings should be escaped and status attributes should be added">
<phrases>
<phrase status="same">Hello!</phrase>
<phrase status="same">Goodbye!</phrase>
<phrase status="changed">\(So long!\)</phrase>
</phrases>
</x:expect>
</x:scenario>
</x:description>

0 comments on commit 33684b7

Please sign in to comment.