Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow context in named templates #76

Open
wants to merge 107 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
07c0c60
PR-76 issue #66 allow context in named templates
cirulls Feb 21, 2016
26a4292
Merge pull request #1 from cirulls/develop
Feb 21, 2016
b0b3001
expath#40 fix code coverage
Aug 10, 2016
91be55e
Merge branch 'develop'
Aug 10, 2016
4a26210
add Travis CI configuration
Aug 11, 2016
c2fdcad
add sudo required
Aug 11, 2016
daee7d5
install bats from GitHub
Aug 11, 2016
070cde7
# This is a combination of 4 commits.
Aug 14, 2016
3c40268
implement JUnit report (#2)
Aug 14, 2016
feb001c
replace saxon:serialize() with fn:serialize #81
Aug 17, 2016
07fdde6
add support for Saxon-9-1-0-8 (Saxon-B) #79
Aug 17, 2016
bc936b7
rename Saxon B jar file as per standard convention (#79)
Aug 17, 2016
df4959b
run tests with Travis CI (#5)
Aug 11, 2016
7e7199b
update link to Travis status page
Aug 21, 2016
6dc9376
add documentation
Aug 21, 2016
954a5ea
merge feature/junit into develop
Aug 21, 2016
0c7a0a0
Merge branch 'develop'
Aug 21, 2016
08cd006
update Travis config for master
Aug 21, 2016
4d82109
merge branch feature/saxon-b
Aug 21, 2016
1eb4b0c
Merge branch 'develop'
Aug 21, 2016
1a4377e
add XSLT 3.0 support #9 (#10)
Aug 29, 2016
cd47860
Merge branch 'develop'
Aug 29, 2016
116c49c
initial commit for bats test #12
Sep 29, 2016
65d9fc2
update Travis configuration #12
Sep 29, 2016
2b21942
test failing test #12
Sep 29, 2016
be28008
run only bats tests
Sep 29, 2016
7295cba
review bats test suite
Sep 29, 2016
8a41236
set TEST_DIR
Sep 29, 2016
86daf71
modify .travis
Sep 29, 2016
7e821e9
remove export in test without TEST_DIR
Sep 29, 2016
48b3dda
test failing tests
Sep 29, 2016
704b149
run XSpec test suite #12
Sep 29, 2016
46924d1
Fixed TEST_DIR management (#13)
c4s4 Sep 29, 2016
fab22d7
add output when test fails
Sep 29, 2016
7b0af25
update Travis configuration
Sep 29, 2016
f870574
override TEST_DIR when set and add bats test (#12 #13)
Sep 29, 2016
706b4e6
fix typo
Sep 29, 2016
53c2b7a
Merge branch 'develop'
Sep 29, 2016
7f3fef3
Fixed TEST_DIR management for winwdows (#14)
c4s4 Oct 17, 2016
63e1495
print message with location of HTML report (#16)
Oct 17, 2016
fdbcf4c
Bugfix/issue67 (#17)
Oct 30, 2016
7303f0d
Fix travis configuration #19
Dec 3, 2016
86e9bbf
use lazy evaluation to fix data type error (#24)
Dec 10, 2016
dcf41fd
reinstate copyright notes #23
Dec 10, 2016
8931b37
force to return the string value of node to support other data types …
Dec 12, 2016
670fcfe
retrieve saxon from maven repo (#34)
Dec 23, 2016
4449512
runner script for XSpec test suite does not detect compiling issues (…
Dec 27, 2016
5a44674
Fix regression bug introduced in v0.4.0-RC (#38)
Jan 1, 2017
70812b3
Revamp xspec.bat (#28)
AirQuick Jan 3, 2017
fe09541
Run tests on AppVeyor (#41)
AirQuick Jan 4, 2017
67461a0
test/xspec-junit.xspec fails with Saxon 9.6.0.10 (#40)
AirQuick Jan 4, 2017
5d6459b
Test with Saxon n and n-0.1 (#43)
AirQuick Jan 5, 2017
1a92c65
remove -j option in tests #39 (#49)
Jan 8, 2017
2a7057b
Run tests in Travis for both Saxon HE 9.7.0-14 and 9.6.0-7 (#45)
Jan 8, 2017
187f157
Always provide xs:boolean in $impl:successful expression (#48)
AirQuick Jan 8, 2017
ba5f97c
add bats test issue #46 / pr #48 (#51)
Jan 8, 2017
a6bb235
remove old references to xspec.googlecode.com #56
Jan 13, 2017
33684b7
remove old references to google repos #56 (#66)
Jan 14, 2017
82a3d49
Remove output and add directories to .gitignore (#65)
Jan 14, 2017
441eae6
Add tests for issue #46 / pr #48 for Windows (#54)
AirQuick Jan 14, 2017
5aa7644
update README and LICENSE files #52 (#53)
Jan 15, 2017
f2db6e4
Run tests with both Saxon 9.6.0-7 and 9.6.0-10 (#68)
tofi86 Jan 16, 2017
9b94529
Report all the basic types and valid numeric expressions (#58)
AirQuick Jan 19, 2017
01c7e25
Keep type annotations in $impl:test-items (#63)
AirQuick Feb 1, 2017
72a4c71
Run tests with Saxon 9.7.0-15 (#77)
AirQuick Feb 14, 2017
ad6b041
Revert harnesses to v0.3.0 and add UTF-8 encoding #74 #72 (#76)
Feb 16, 2017
bae9ce1
Consolidate cleanup tasks in batch script(#73)
AirQuick Mar 4, 2017
cd1908a
Highlight the link target (#79)
AirQuick Mar 4, 2017
ef2d44c
Run XProc test on AppVeyor (#86)
AirQuick Mar 7, 2017
f4811a5
Align Travis configuration with AppVeyor in #86 (#96)
Mar 7, 2017
a5ceb3a
Get the URLs back, adapted.
fgeorges Mar 7, 2017
a93e273
Fix indent.
fgeorges Mar 7, 2017
388c62e
Revive @assert and @context.
fgeorges Mar 7, 2017
74c9f0c
Merge branch 'master' of github.com:xspec/xspec
fgeorges Mar 7, 2017
8946ab5
revert to commit f4811a5 as tests are failing on master #97 (#101)
Mar 15, 2017
74312e1
add XProc harness for Saxon from v0.4.0 (#108)
Mar 15, 2017
2f71caa
Display result.log on test failure (#110)
AirQuick Mar 29, 2017
359b721
Update Saxon versions (#116)
AirQuick Apr 8, 2017
e99b5a2
Make XProc testing command lines more portable (#98)
AirQuick Apr 8, 2017
120b331
Separate common tests (for XSLT and XQuery) from generate-tests-utils…
AirQuick Apr 9, 2017
0ef7b8c
Added documentation for attributes in RNG schema (#115)
raducoravu Apr 10, 2017
cb4b235
Migrate test:tests to test/*.xspec (#118)
AirQuick Apr 10, 2017
701bd34
Stop using functx namespace (#104)
AirQuick Apr 16, 2017
a2b8e59
Do not copy unused namespaces from format utils to output (#91)
AirQuick Apr 16, 2017
9f28df6
xspec.bat (Windows) fails when path contains parentheses
AirQuick Apr 16, 2017
4e99c1d
Escape apostrophe in URI (#119)
Apr 17, 2017
942e26f
Run tests with XML Calabash 1.1.16-97 (#123)
AirQuick Apr 20, 2017
1101540
add checks for saxon script + test (#124)
Apr 22, 2017
6b6d07b
add Schematron support (#105)
vincentml May 4, 2017
e318391
Add documentation for Schematron support (#129)
May 25, 2017
436ceb0
add XProc harness for BaseX standalone (review #103) (#136)
Jun 10, 2017
c25a849
From pull request #129 discussion: suppress warning message and clean…
vincentml Jun 26, 2017
a602c4b
Allow Schematron XSLTs to be provided externally (#133)
vincentml Jun 26, 2017
a032c19
End-to-end test for XSpec itself (#81)
AirQuick Aug 29, 2017
73aa6f9
Add TODO comments for focus/pending tests in #4 (#61)
AirQuick Aug 30, 2017
cc3a18b
Run tests with latest Saxon HE 9.7 maintenance release (9.7.0.20) (#146)
AirQuick Aug 31, 2017
9608693
Add end-to-end tests for testing failing and pending functionalities
AirQuick Oct 1, 2017
5f2cf8c
Remove JAVA_OPTIONS message from output in Travis (#148)
Oct 1, 2017
4031674
Replace regression tests for #50 and #55 as end-to-end tests (#145)
AirQuick Oct 1, 2017
7205f22
Balisage improvements to Schematron support (#149)
vincentml Nov 6, 2017
78f63a6
Run tests with Saxon 9.8.0.7, 9.7.0.21 and 9.7.0.19 (#157)
AirQuick Dec 28, 2017
c76d4fd
Improvements to HTML report (#135)
vincentml Jan 7, 2018
ffd5eda
Add tests for CSS inline (#159)
Jan 24, 2018
63cf95d
Add Ant build support for Schematron (#160)
Feb 4, 2018
c9fdb91
Add a pom file to publish XSpec as a Maven artifact (#156)
cmarchand Mar 18, 2018
b5707e9
Include path to the test source files in all report formats (#188)
vincentml Apr 2, 2018
0e21fca
Enhance coverage-report.xsl to be able to specify css location (#194)
cmarchand Apr 9, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix regression bug introduced in v0.4.0-RC (#38)
* revert to x:output-expect from v0.3.0 #26 #30 #33

- use x:output-expect from v0.3.0 to fix regression bugs in #26 #30 #33
- remove attributes assert and context of x:expect as assert seems a duplicate of test and there is no documentation on how these attributes should behave
- in the test suite remove x:expect for tests using attribute assert as they are all duplicates of test
- add more tests to cover #26 #30 #33
Sandro Cirulli authored Jan 1, 2017
commit 5a4467402c10290ed14264c09226042ceba9b5d7
361 changes: 2 additions & 359 deletions src/compiler/generate-xspec-tests.xsl
Original file line number Diff line number Diff line change
@@ -285,123 +285,8 @@
<xsl:call-template name="x:compile-scenarios"/>
</xsl:template>

<!--
Generate the following:

TODO: Review if it is still ok, regarding the below new description...

<template name="x:...">
<param name="x:result" required="yes"/> # if not pending
<message>
Running (pending?) assertion...
</message>
# if not pending
<variable name="impl:expected" ...> # depend on content, @href and @select
# if @context, change the context to the result of evaluating it
# if no @context, the result is the context (if exactly one item)
# if @assert, evaluate it, the result must be boolean
# if @test, evaluate it with result as context node then
# if it is not a boolean, compare it to $impl:expected
# if no @test, compare result to $impl:expected
# fi
<x:test>
...
</x:test>
</template>

By assertion
@assert
@assert, @context

By comparing nodes
content
content, @context

By comparing atomic values
@select
@select, @context

Old-school (result wrapped into doc node)
@test (= @assert)
@test, @context (= @assert, @context)
content, @test (= content, @context)
-> actually, that's not exctly what has been implemented
now we evaluate @test, and if it results to one boolean,
then that's an assert, if not it is compared to content

Context: if multiple items, loop as current item ($x:result still full result)
- with @assert, assertion eval'd once for each
- with content, compare the whole sequence
- with @select, compare the whole sequence

IF @context
set context (@context)
ELIF @test AND content
set context (@test)
ELSE
set context ($result)

IF @assert
assert (@assert)
ELIF content
compare (content)
ELIF @select
compare (@select)
ELIF @test AND content
compare (content)
ELIF @test
assert (@test)

set context (@context):
variable with-context := true
variable context
if count($result) <= 1
eval @context with $result as context
else
eval @context without any context
-> must be ONE item

set context (@test):
variable with-context := true
variable context
like set context (@context), but if node()+, then wrap in doc node

set context ($result):
variable with-context := true
variable context
no context if count($result) ne 1
like set context (@context) if no @test
like set context (@test) if @test

no context:
variable with-context := false
variable context := ()

assert (@assert):
if $with-context
evaluate assert with $context
else
evaluate assert without context

compare (content):
if $with-context
compare $context to content
else
compare $result to content

compare (@select):
if $with-context
compare $context to content
else
compare $result to content

assert (@test):
if $with-context
evaluate @test with $context
else
evaluate @test without context
-->
<xsl:template name="x:output-expect-FIXME-TOREMOVE">

<xsl:template name="x:output-expect">
<xsl:param name="pending" select="()" tunnel="yes" as="node()?"/>
<xsl:param name="context" required="yes" tunnel="yes" as="element(x:context)?"/>
<xsl:param name="call" required="yes" tunnel="yes" as="element(x:call)?"/>
@@ -508,248 +393,6 @@
</template>
</xsl:template>

<xsl:template name="x:output-expect">
<xsl:param name="pending" select="()" tunnel="yes" as="node()?"/>
<xsl:param name="context" required="yes" tunnel="yes" as="element(x:context)?"/>
<xsl:param name="call" required="yes" tunnel="yes" as="element(x:call)?"/>
<xsl:param name="params" required="yes" as="element(param)*"/>
<xsl:variable name="pending-p" select="exists($pending) and empty(ancestor::*/@focus)"/>
<template name="x:{generate-id()}">
<xsl:for-each select="$params">
<param name="{ @name }" required="{ @required }"/>
</xsl:for-each>
<message>
<xsl:if test="$pending-p">
<xsl:text>PENDING: </xsl:text>
<xsl:if test="normalize-space($pending) != ''">
<xsl:text>(</xsl:text>
<xsl:value-of select="normalize-space($pending)"/>
<xsl:text>) </xsl:text>
</xsl:if>
</xsl:if>
<xsl:value-of select="normalize-space(x:label(.))"/>
</message>
<xsl:variable name="is-assert" select="empty(node()|@select)"/>
<xsl:if test="not($pending-p)">
<xsl:variable name="version" as="xs:double" select="
( ancestor-or-self::*[@xslt-version]/@xslt-version, 2.0 )[1]"/>

<!--
CONTEXT

IF @context
set context (@context)
ELIF @test AND content
set context (@test)
ELIF count($result) = 1
set context ($result)
ELSE
no context
-->
<xsl:choose>
<xsl:when test="exists(@context)">
<variable name="impl:with-context" select="true()"/>
<variable name="impl:context" as="item()?">
<choose>
<!-- aka "count($x:result) le 1" (so if empty, context is empty too) -->
<when test="empty($x:result[2])">
<for-each select="$x:result">
<sequence select="{ @context }"/>
</for-each>
</when>
<!-- when count($x:result) ge 2 -->
<otherwise>
<!-- no context node set here -->
<sequence select="{ @context }"/>
</otherwise>
</choose>
</variable>
</xsl:when>
<xsl:when test="exists(@test) and exists(node())">
<variable name="impl:with-context" select="true()"/>
<variable name="impl:context-tmp" as="item()*">
<choose>
<!-- aka "count($x:result) le 1" (so if empty, context is empty too) -->
<when test="empty($x:result[2])">
<for-each select="$x:result">
<sequence select="{ @test }"/>
</for-each>
</when>
<!-- when count($x:result) ge 2 -->
<otherwise>
<!-- no context node set here -->
<sequence select="{ @test }"/>
</otherwise>
</choose>
</variable>
<variable name="impl:context" as="item()?">
<choose>
<when test="$impl:context-tmp instance of node()+">
<document>
<sequence select="$impl:context-tmp"/>
</document>
</when>
<otherwise>
<sequence select="$impl:context-tmp"/>
</otherwise>
</choose>
</variable>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="exists(@test)">
<variable name="impl:just-nodes" select="
$x:result instance of node()+"/>
<!-- aka "count($x:result) eq 1 or ..." -->
<variable name="impl:with-context" select="
exists($x:result) and empty($x:result[2]) or $impl:just-nodes"/>
<variable name="impl:context" as="item()?">
<choose>
<when test="$impl:just-nodes">
<document>
<sequence select="$x:result"/>
</document>
</when>
<when test="$impl:with-context">
<sequence select="$x:result"/>
</when>
<otherwise/>
</choose>
</variable>
</xsl:when>
<xsl:otherwise>
<!-- aka "count($x:result) eq 1" -->
<variable name="impl:with-context" select="
exists($x:result) and empty($x:result[2])"/>
<variable name="impl:context" as="item()?">
<choose>
<when test="$impl:with-context">
<sequence select="$x:result"/>
</when>
<otherwise/>
</choose>
</variable>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>

<!--
ASSERT & COMPARE

IF content|@select
compare (content|@select)
ELIF @assert|@test
assert (@assert|@test)
ELSE
compilation error

every branch of this xsl:choose generates the variable $impl:successful,
which is a boolean with the outcome of the test case (either passed or
failed), and which is used later on in the generated code
-->
<xsl:choose>
<xsl:when test="not($is-assert)">
<!-- check there is exactly one of node()|@select -->
<xsl:if test="exists(node()) and exists(@select)">
<xsl:message terminate="yes">
<xsl:text>ERROR in scenario "</xsl:text>
<xsl:value-of select="x:label(.)"/>
<xsl:text>": can't have both @select and context at the same time</xsl:text>
</xsl:message>
</xsl:if>
<xsl:apply-templates select="." mode="test:generate-variable-declarations">
<xsl:with-param name="var" select="'impl:expected'"/>
</xsl:apply-templates>
<variable name="impl:successful" as="xs:boolean" select="
test:deep-equal(
$impl:expected,
if ( $impl:with-context ) then $impl:context else $x:result,
{ $version })"/>
</xsl:when>
<xsl:when test="exists(@assert|@test)">
<!-- check there is exactly one of @assert|@test -->
<xsl:if test="exists(@assert) and exists(@test)">
<xsl:message terminate="yes">
<xsl:text>ERROR in scenario "</xsl:text>
<xsl:value-of select="x:label(.)"/>
<xsl:text>": can't have both @context and @test at the same time</xsl:text>
</xsl:message>
</xsl:if>
<variable name="impl:assert" as="item()*">
<choose>
<when test="$impl:with-context">
<for-each select="$impl:context">
<sequence select="{ @assert|@test }"/>
</for-each>
</when>
<otherwise>
<sequence select="{ @assert|@test }"/>
</otherwise>
</choose>
</variable>
<if test="not($impl:assert instance of xs:boolean)">
<!-- TODO: For now, generate an error, make the test fails instead? -->
<message terminate="yes">
<xsl:text>ERROR in scenario "</xsl:text>
<xsl:value-of select="x:label(.)"/>
<!-- TODO: Generate the SequenceType of $impl:assert. -->
<xsl:text>": @assert|@test did not return a boolean</xsl:text>
</message>
</if>
<variable name="impl:successful" as="xs:boolean" select="$impl:assert"/>
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
<xsl:text>ERROR in scenario "</xsl:text>
<xsl:value-of select="x:label(.)"/>
<xsl:text>": unknown expect combination</xsl:text>
<xsl:text>&#10; content : </xsl:text>
<xsl:value-of select="exists(node())"/>
<xsl:text>&#10; @context: </xsl:text>
<xsl:value-of select="exists(@context)"/>
<xsl:text>&#10; @assert : </xsl:text>
<xsl:value-of select="exists(@assert)"/>
<xsl:text>&#10; @select : </xsl:text>
<xsl:value-of select="exists(@select)"/>
<xsl:text>&#10; @test : </xsl:text>
<xsl:value-of select="exists(@test)"/>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
<if test="not($impl:successful)">
<message>
<xsl:text> FAILED</xsl:text>
</message>
</if>
</xsl:if>
<x:test>
<xsl:choose>
<xsl:when test="$pending-p">
<xsl:attribute name="pending" select="$pending"/>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="successful" select="'{ $impl:successful }'"/>
</xsl:otherwise>
</xsl:choose>
<xsl:sequence select="x:label(.)"/>
<xsl:if test="not($pending-p)">
<call-template name="test:report-value">
<with-param name="value" select="$x:result"/>
<with-param name="wrapper-name" select="'x:result'"/>
<with-param name="wrapper-ns" select="'{ $xspec-ns }'"/>
</call-template>
<xsl:if test="not($is-assert)">
<call-template name="test:report-value">
<with-param name="value" select="$impl:expected"/>
<with-param name="wrapper-name" select="'x:expect'"/>
<with-param name="wrapper-ns" select="'{ $xspec-ns }'"/>
</call-template>
</xsl:if>
</xsl:if>
</x:test>
</template>
</xsl:template>

<!-- *** x:generate-declarations *** -->
<!-- Code to generate parameter declarations -->
148 changes: 65 additions & 83 deletions test/generate-tests-utils.xspec
Original file line number Diff line number Diff line change
@@ -8,101 +8,83 @@
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<?oxygen RNGSchema="http://xspec.googlecode.com/svn/trunk/xspec.rnc" type="compact"?>
<t:description xmlns:t="http://www.jenitennison.com/xslt/xspec" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:test="http://www.jenitennison.com/xslt/unit-test" query="http://www.jenitennison.com/xslt/unit-test" query-at="../src/compiler/generate-query-utils.xql" stylesheet="../src/compiler/generate-tests-utils.xsl">
<!--
<!--
Test the source files generate-tests-utils.xsl and generate-query-utils.xql.
-->
<!--
Function test:deep-equal($seq1, $seq2).
-->
<t:scenario label="test:deep-equal($seq1, $seq2)">

<t:scenario label="Identical Sequences">
<t:call function="test:deep-equal">
<t:param select="1, 2"/>
<t:param select="1, 2"/>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
<t:expect label="the result" assert="$x:result eq true()"/>
</t:scenario>

<t:scenario label="Non-Identical Sequences">
<t:call function="test:deep-equal">
<t:param select="1, 2"/>
<t:param select="1, 3"/>
</t:call>
<t:expect label="the result" test="$x:result eq false()"/>
<t:expect label="the result" assert="$x:result eq false()"/>
</t:scenario>

<t:scenario label="Sequences with Same Items in Different Orders">
<t:call function="test:deep-equal">
<t:param select="1, 2"/>
<t:param select="2, 1"/>
</t:call>
<t:expect label="the result" test="$x:result eq false()"/>
<t:expect label="the result" assert="$x:result eq false()"/>
</t:scenario>

<t:scenario label="Empty Sequences">
<t:call function="test:deep-equal">
<t:param select="()"/>
<t:param select="()"/>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
<t:expect label="the result" assert="$x:result eq true()"/>
</t:scenario>

<t:scenario label="One empty sequence">
<t:call function="test:deep-equal">
<t:param select="()"/>
<t:param select="1"/>
</t:call>
<t:expect label="the result" test="$x:result eq false()"/>
<t:expect label="the result" assert="$x:result eq false()"/>
</t:scenario>

<t:scenario label="A text node and several text nodes">
<t:variable name="elems" as="element()+">
<e>foo</e>
<e>bar</e>
</t:variable>
<t:call function="test:deep-equal">
<t:param as="text()">foobar</t:param>
<t:param select="$elems/text()"/>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
<t:expect label="the result" assert="$x:result eq true()"/>
</t:scenario>

<t:scenario label="Identical Sequences">
<t:call function="test:deep-equal">
<t:param select="1, 2"/>
<t:param select="1, 2"/>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
</t:scenario>
<t:scenario label="Non-Identical Sequences">
<t:call function="test:deep-equal">
<t:param select="1, 2"/>
<t:param select="1, 3"/>
</t:call>
<t:expect label="the result" test="$x:result eq false()"/>
</t:scenario>
<t:scenario label="Sequences with Same Items in Different Orders">
<t:call function="test:deep-equal">
<t:param select="1, 2"/>
<t:param select="2, 1"/>
</t:call>
<t:expect label="the result" test="$x:result eq false()"/>
</t:scenario>
<t:scenario label="Empty Sequences">
<t:call function="test:deep-equal">
<t:param select="()"/>
<t:param select="()"/>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
</t:scenario>
<t:scenario label="One empty sequence">
<t:call function="test:deep-equal">
<t:param select="()"/>
<t:param select="1"/>
</t:call>
<t:expect label="the result" test="$x:result eq false()"/>
</t:scenario>
<t:scenario label="A text node and several text nodes">
<t:variable name="elems" as="element()+">
<e>foo</e>
<e>bar</e>
</t:variable>
<t:call function="test:deep-equal">
<t:param as="text()">foobar</t:param>
<t:param select="$elems/text()"/>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
</t:scenario>
</t:scenario>

<!--
Function test:node-deep-equal($seq1, $seq2).
-->
<t:scenario label="test:node-deep-equal($seq1, $seq2)">

<t:scenario label="Identical Element Sequences">
<t:call function="test:node-deep-equal">
<t:param name="node1">foobar</t:param>
<t:param name="node2">foobar</t:param>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
</t:scenario>

<t:scenario label="Identical Attribute Sequences">
<t:call function="test:node-deep-equal">
<t:param name="node1" select="/node/@attribute" as="node()">
<node attribute="foobar"/>
</t:param>
<t:param name="node2" select="/node/@attribute" as="node()">
<node attribute="foobar"/>
</t:param>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
</t:scenario>

<t:scenario label="Identical Element Sequences">
<t:call function="test:node-deep-equal">
<t:param name="node1">foobar</t:param>
<t:param name="node2">foobar</t:param>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
</t:scenario>
<t:scenario label="Identical Attribute Sequences">
<t:call function="test:node-deep-equal">
<t:param name="node1" select="/node/@attribute" as="node()">
<node attribute="foobar"/>
</t:param>
<t:param name="node2" select="/node/@attribute" as="node()">
<node attribute="foobar"/>
</t:param>
</t:call>
<t:expect label="the result" test="$x:result eq true()"/>
</t:scenario>
</t:scenario>

</t:description>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. -->
78 changes: 27 additions & 51 deletions test/generate-xspec-tests.xspec
Original file line number Diff line number Diff line change
@@ -6,60 +6,36 @@
<!-- Tags: -->
<!-- Copyright (c) 2010 Jeni Tennsion (see end of file.) -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->


<t:description xmlns:t="http://www.jenitennison.com/xslt/xspec"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
stylesheet="../src/compiler/generate-xspec-tests.xsl">

<!--
<t:description xmlns:t="http://www.jenitennison.com/xslt/xspec" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" stylesheet="../src/compiler/generate-xspec-tests.xsl">
<!--
Test the source file generate-xspec-tests.xsl.
-->

<t:scenario label="test:deep-equal($seq1, $seq2)">

<!--t:scenario label="FIRST TEST.......">
<t:variable name="ctxt" as="document-node()">
<t:description>
<t:scenario/>
</t:description>
</t:variable>
<t:apply select="$ctxt"/>
<t:expect label="the result" test="$t:result instance of document-node()"/>
<t:expect label="the result" assert="$t:result instance of document-node()"/>
</t:scenario-->

<t:scenario label="FIRST TEST.......">
<t:context mode="t:compile">
<t:scenario label="my label"/>
</t:context>
<t:expect label="is a template" test="$t:result instance of element(xsl:template)"/>
<!-- test also it is a QName in the namespace x:* -->
<t:expect label="the name" test="exists($t:result/@name)"/>
<t:expect label="the name is a QName" test="
namespace-uri-from-QName(resolve-QName($t:result/@name, $t:result))
eq 'http://www.jenitennison.com/xslt/xspec'"/>
<t:expect label="the label message" test="$t:result/xsl:message eq 'my label'"/>
<t:expect label="the scenario" test="exists($t:result/t:scenario)"/>
<t:expect label="the scenario label" test="$t:result/t:scenario/t:label eq 'my label'"/>
<!-- TODO: Use @assert instead of @test... -->
<t:expect label="is a template" assert="$t:result instance of element(xsl:template)"/>
<!-- test also it is a QName in the namespace x:* -->
<t:expect label="the name" assert="exists($t:result/@name)"/>
<t:expect label="the name is a QName" assert="
namespace-uri-from-QName(resolve-QName($t:result/@name, $t:result))
eq 'http://www.jenitennison.com/xslt/xspec'"/>
<t:expect label="the label message" assert="$t:result/xsl:message eq 'my label'"/>
<t:expect label="the scenario" assert="exists($t:result/t:scenario)"/>
<t:expect label="the scenario label" assert="$t:result/t:scenario/t:label eq 'my label'"/>
</t:scenario>

</t:scenario>

<t:scenario label="test:deep-equal($seq1, $seq2)">
<!--
<t:scenario label="FIRST TEST.......">
<t:variable name="ctxt" as="document-node()">
<t:description>
<t:scenario/>
</t:description>
</t:variable>
<t:apply select="$ctxt"/>
<t:expect label="the result" test="$t:result instance of document-node()"/>
</t:scenario>
-->
<t:scenario label="FIRST TEST.......">
<t:context mode="t:compile">
<t:scenario label="my label"/>
</t:context>
<t:expect label="is a template" test="$t:result instance of element(xsl:template)"/>
<!-- test also it is a QName in the namespace x:* -->
<t:expect label="the name" test="exists($t:result/@name)"/>
<t:expect label="the name is a QName" test=" namespace-uri-from-QName(resolve-QName($t:result/@name, $t:result)) eq 'http://www.jenitennison.com/xslt/xspec'"/>
<t:expect label="the label message" test="$t:result/xsl:message eq 'my label'"/>
<t:expect label="the scenario" test="exists($t:result/t:scenario)"/>
<t:expect label="the scenario label" test="$t:result/t:scenario/t:label eq 'my label'"/>
</t:scenario>
</t:scenario>
</t:description>


<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. -->
<!-- -->
7 changes: 0 additions & 7 deletions test/unit-expect-xsl.xspec
Original file line number Diff line number Diff line change
@@ -22,15 +22,8 @@
<t:expect test="false()"/>
</t:context>
<t:expect label="is a template" test="$t:result instance of element(xsl:template)"/>
<!--
<t:expect label="@test must be transformed to @select" test="$t:result/xsl:variable[@name eq 'impl:test-result']/*/xsl:otherwise/*">
<xsl:sequence select="false()" version="..."/>
</t:expect>
-->
<t:expect label="is a template" assert="$t:result instance of element(xsl:template)"/>
<!--
<t:expect label="@test must be transformed to @select" context="$t:result/xsl:variable[@name eq 'impl:test-result']/*/xsl:otherwise/*">
<xsl:sequence select="false()" version="..."/>
</t:expect> -->
</t:scenario>
</t:description>
19 changes: 19 additions & 0 deletions test/xspec-26.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">

<xsl:template match="document">
<container>
<xsl:apply-templates/>
</container>
</xsl:template>

<xsl:template match="heading">
<child>
<xsl:apply-templates/>
</child>
</xsl:template>

</xsl:stylesheet>
17 changes: 17 additions & 0 deletions test/xspec-26.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- full description at https://github.com/xspec/xspec/26 -->
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" stylesheet="xspec-26.xsl">
<x:scenario label="When converting heading element">
<x:context>
<document>
<heading>Some Text</heading>
</document>
</x:context>
<x:expect label="Wrap it in a container element">
<container>...</container>
</x:expect>
<x:expect label="With a child" test="container/child[1]">
<child>Some Text</child>
</x:expect>
</x:scenario>
</x:description>
2 changes: 2 additions & 0 deletions test/xspec-30.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<foo/>
6 changes: 6 additions & 0 deletions test/xspec-30.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template as="document-node()" match="document-node()">
<xsl:sequence select="." />
</xsl:template>
</xsl:stylesheet>
8 changes: 8 additions & 0 deletions test/xspec-30.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- full description at https://github.com/xspec/xspec/issues/30 -->
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" stylesheet="xspec-30.xsl">
<x:scenario label="When an XML is passed via the href attribute of x:context">
<x:context href="xspec-30.xml"/>
<x:expect href="xspec-30.xml" label="the href attribute of x:expect works"/>
</x:scenario>
</x:description>
7 changes: 7 additions & 0 deletions test/xspec-33.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet exclude-result-prefixes="#all" version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template as="node()" match="node()">
<xsl:sequence select="." />
</xsl:template>
</xsl:stylesheet>
15 changes: 15 additions & 0 deletions test/xspec-33.xspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" stylesheet="xspec-33.xsl">
<x:scenario label="When context contains descendant">
<x:context>
<foo>
<bar>
<baz>original-text</baz>
</bar>
</foo>
</x:context>
<x:expect label="descendant is picked up correctly using XPath in @test" test="descendant::baz">
<baz>original-text</baz>
</x:expect>
</x:scenario>
</x:description>
4 changes: 0 additions & 4 deletions test/xspec-focus-1.xspec
Original file line number Diff line number Diff line change
@@ -18,14 +18,12 @@
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
<t:expect label="the result" assert="$x:result eq 9"/>
</t:scenario>
<t:scenario label="pending must fail">
<t:call function="my:square">
<t:param select="2"/>
</t:call>
<t:expect label="the type" test="$x:result instance of xs:string"/>
<t:expect label="the type" assert="$x:result instance of xs:string"/>
</t:scenario>
<!--
Focused on scenarios.
@@ -35,14 +33,12 @@
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
<t:expect label="the result" assert="$x:result eq 9"/>
</t:scenario>
<t:scenario label="focus must fail">
<t:call function="my:square">
<t:param select="2"/>
</t:call>
<t:expect label="the type" test="$x:result instance of xs:string"/>
<t:expect label="the type" assert="$x:result instance of xs:string"/>
</t:scenario>
</t:description>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
109 changes: 40 additions & 69 deletions test/xspec-focus-2.xspec
Original file line number Diff line number Diff line change
@@ -6,89 +6,60 @@
<!-- Tags: -->
<!-- Copyright (c) 2010 Jeni Tennsion (see end of file.) -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->


<?oxygen RNGSchema="http://xspec.googlecode.com/svn/trunk/xspec.rnc" type="compact"?>

<t:description xmlns:t="http://www.jenitennison.com/xslt/xspec"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:my="http://example.org/ns/my"
query="http://example.org/ns/my"
query-at="xspec-tested.xql"
stylesheet="xspec-tested.xsl">

<!--
<t:description xmlns:t="http://www.jenitennison.com/xslt/xspec" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:my="http://example.org/ns/my" query="http://example.org/ns/my" query-at="xspec-tested.xql" stylesheet="xspec-tested.xsl">
<!--
Test @focus and pending toghether (both @pending and t:pending).
-->

<!--
<!--
Test x:pending.
-->
<t:pending label="testing pending element">

<t:scenario label="pending call (element)">
<t:call function="my:square">
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
<t:expect label="the result" assert="$x:result eq 9"/>
</t:scenario>

<t:scenario label="pending call (element) + focus" focus="focus">
<t:call function="my:square">
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
<t:expect label="the result" assert="$x:result eq 9"/>
</t:scenario>

</t:pending>

<!--
Non-pending scenarios.
-->
<t:scenario label="call">
<t:pending label="testing pending element">
<t:scenario label="pending call (element)">
<t:call function="my:square">
<t:param select="3"/>
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
<t:expect label="the result" assert="$x:result eq 9"/>
</t:scenario>

<t:scenario label="call + focus" focus="focus">
</t:scenario>
<t:scenario label="pending call (element) + focus" focus="focus">
<t:call function="my:square">
<t:param select="3"/>
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
<t:expect label="the result" assert="$x:result eq 9"/>
</t:scenario>

<!--
</t:scenario>
</t:pending>
<!--
Non-pending scenarios.
-->
<t:scenario label="call">
<t:call function="my:square">
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
</t:scenario>
<t:scenario label="call + focus" focus="focus">
<t:call function="my:square">
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
</t:scenario>
<!--
Test @pending.
-->
<t:scenario label="pending call (attribute)"
pending="testing pending attribute">
<t:call function="my:square">
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
<t:expect label="the result" assert="$x:result eq 9"/>
</t:scenario>

<!-- does not make sense, really, but to see how the implem reacts -->
<t:scenario label="pending call (attribute) + focus"
pending="testing pending attribute"
focus="focus">
<t:call function="my:square">
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
<t:expect label="the result" assert="$x:result eq 9"/>
</t:scenario>

<t:scenario label="pending call (attribute)" pending="testing pending attribute">
<t:call function="my:square">
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
</t:scenario>
<!-- does not make sense, really, but to see how the implem reacts -->
<t:scenario label="pending call (attribute) + focus" pending="testing pending attribute" focus="focus">
<t:call function="my:square">
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
</t:scenario>
</t:description>


<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. -->
<!-- -->
3 changes: 0 additions & 3 deletions test/xspec-function.xspec
Original file line number Diff line number Diff line change
@@ -14,15 +14,12 @@
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
<t:expect label="the type" test="$x:result instance of xs:integer"/>
<t:expect label="the result" assert="$x:result eq 9"/>
<t:expect label="the type" assert="$x:result instance of xs:integer"/>
</t:scenario>
<t:scenario label="must fail">
<t:call function="my:square">
<t:param select="2"/>
</t:call>
<t:expect label="wrong result" test="$x:result eq 42"/>
<t:expect label="wrong result" assert="$x:result eq 42"/>
</t:scenario>
</t:description>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
47 changes: 15 additions & 32 deletions test/xspec-import.xspec
Original file line number Diff line number Diff line change
@@ -6,40 +6,23 @@
<!-- Tags: -->
<!-- Copyright (c) 2010 Jeni Tennsion (see end of file.) -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->


<?oxygen RNGSchema="http://xspec.googlecode.com/svn/trunk/xspec.rnc" type="compact"?>

<t:description xmlns:t="http://www.jenitennison.com/xslt/xspec"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:my="http://example.org/ns/my"
query="http://example.org/ns/my"
query-at="xspec-tested.xql"
stylesheet="xspec-tested.xsl">

<t:import href="xspec-imported.xspec"/>

<t:scenario label="call">
<t:call function="my:square">
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
<t:expect label="the type" test="$x:result instance of xs:integer"/>
<t:expect label="the result" assert="$x:result eq 9"/>
<t:expect label="the type" assert="$x:result instance of xs:integer"/>
</t:scenario>

<t:scenario label="must fail">
<t:call function="my:square">
<t:param select="2"/>
</t:call>
<t:expect label="the type" test="$x:result instance of xs:string"/>
<t:expect label="the type" assert="$x:result instance of xs:string"/>
</t:scenario>

<t:description xmlns:t="http://www.jenitennison.com/xslt/xspec" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:my="http://example.org/ns/my" query="http://example.org/ns/my" query-at="xspec-tested.xql" stylesheet="xspec-tested.xsl">
<t:import href="xspec-imported.xspec"/>
<t:scenario label="call">
<t:call function="my:square">
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
<t:expect label="the type" test="$x:result instance of xs:integer"/>
</t:scenario>
<t:scenario label="must fail">
<t:call function="my:square">
<t:param select="2"/>
</t:call>
<t:expect label="the type" test="$x:result instance of xs:string"/>
</t:scenario>
</t:description>


<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. -->
<!-- -->
2 changes: 0 additions & 2 deletions test/xspec-imported.xspec
Original file line number Diff line number Diff line change
@@ -13,14 +13,12 @@
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
<t:expect label="the result" assert="$x:result eq 9"/>
</t:scenario>
<t:scenario label="must fail">
<t:call function="my:square">
<t:param select="2"/>
</t:call>
<t:expect label="wrong result" test="$x:result eq 42"/>
<t:expect label="wrong result" assert="$x:result eq 42"/>
</t:scenario>
</t:description>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
6 changes: 0 additions & 6 deletions test/xspec-pending.xspec
Original file line number Diff line number Diff line change
@@ -20,14 +20,12 @@
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
<t:expect label="the result" assert="$x:result eq 9"/>
</t:scenario>
<t:scenario label="pending must fail (element)">
<t:call function="my:square">
<t:param select="2"/>
</t:call>
<t:expect label="the type" test="$x:result instance of xs:string"/>
<t:expect label="the type" assert="$x:result instance of xs:string"/>
</t:scenario>
</t:pending>
<!--
@@ -38,14 +36,12 @@
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
<t:expect label="the result" assert="$x:result eq 9"/>
</t:scenario>
<t:scenario label="must fail">
<t:call function="my:square">
<t:param select="2"/>
</t:call>
<t:expect label="the type" test="$x:result instance of xs:string"/>
<t:expect label="the type" assert="$x:result instance of xs:string"/>
</t:scenario>
<!--
Test @pending.
@@ -55,14 +51,12 @@
<t:param select="3"/>
</t:call>
<t:expect label="the result" test="$x:result eq 9"/>
<t:expect label="the result" assert="$x:result eq 9"/>
</t:scenario>
<t:scenario label="pending must fail (attribute)" pending="testing pending attribute">
<t:call function="my:square">
<t:param select="2"/>
</t:call>
<t:expect label="the type" test="$x:result instance of xs:string"/>
<t:expect label="the type" assert="$x:result instance of xs:string"/>
</t:scenario>
</t:description>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
52 changes: 18 additions & 34 deletions test/xspec-variable.xspec
Original file line number Diff line number Diff line change
@@ -6,47 +6,31 @@
<!-- Tags: -->
<!-- Copyright (c) 2010 Jeni Tennsion (see end of file.) -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->


<?oxygen RNGSchema="http://xspec.googlecode.com/svn/trunk/xspec.rnc" type="compact"?>

<t:description xmlns:t="http://www.jenitennison.com/xslt/xspec"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:my="http://example.org/ns/my"
query="http://example.org/ns/my"
query-at="xspec-tested.xql"
stylesheet="xspec-tested.xsl">

<t:variable name="test-data" href="xspec-variable.xml"/>
<t:variable name="test-3" select="$test-data/*/test[xs:integer(@num) eq 3]"/>

<t:scenario label="call global var">
<t:call function="my:square">
<t:param select="$test-3/@num"/>
</t:call>
<t:expect label="the result" test="$x:result eq $test-3/xs:integer(@value)"/>
<t:expect label="the result" assert="$x:result eq $test-3/xs:integer(@value)"/>
</t:scenario>

<!--
<t:description xmlns:t="http://www.jenitennison.com/xslt/xspec" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:my="http://example.org/ns/my" query="http://example.org/ns/my" query-at="xspec-tested.xql" stylesheet="xspec-tested.xsl">
<t:variable name="test-data" href="xspec-variable.xml"/>
<t:variable name="test-3" select="$test-data/*/test[xs:integer(@num) eq 3]"/>
<t:scenario label="call global var">
<t:call function="my:square">
<t:param select="$test-3/@num"/>
</t:call>
<t:expect label="the result" test="$x:result eq $test-3/xs:integer(@value)"/>
</t:scenario>
<!--
TODO: For now, x:call and x:context are pulled first, then
templates are applied to other x:scenario/*. So the order is
not respected, and the variable declaration is compiled after
the call/appling!
-->
<t:scenario label="call local var">
<t:variable name="param" select="$test-3/@num"/>
<t:call function="my:square">
<t:param select="$param"/>
</t:call>
<t:variable name="result" select="$test-3/@value"/>
<t:expect label="the result" test="$x:result eq xs:integer($result)"/>
<t:expect label="the result" assert="$x:result eq xs:integer($result)"/>
</t:scenario>

<t:scenario label="call local var">
<t:variable name="param" select="$test-3/@num"/>
<t:call function="my:square">
<t:param select="$param"/>
</t:call>
<t:variable name="result" select="$test-3/@value"/>
<t:expect label="the result" test="$x:result eq xs:integer($result)"/>
</t:scenario>
</t:description>


<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS COMMENT. -->
<!-- -->