Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
155 lines (133 sloc) 4.17 KB
<?xml version="1.0" encoding="UTF-8"?>
<!--
: Copyright (c) 2011-2012 Michael Blakeley. All Rights Reserved.
:
: Licensed under the Apache License, Version 2.0 (the "License");
: you may not use this file except in compliance with the License.
: You may obtain a copy of the License at
:
: http://www.apache.org/licenses/LICENSE-2.0
:
: Unless required by applicable law or agreed to in writing, software
: distributed under the License is distributed on an "AS IS" BASIS,
: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
: See the License for the specific language governing permissions and
: limitations under the License.
:
: The use of the Apache License does not indicate that this project is
: affiliated with the Apache Software Foundation.
-->
<suite xmlns="com.blakeley.xqut"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cts="http://marklogic.com/cts">
<environment
root="/Users/mblakele/Source/mblakele-xqut/"
database-name="Documents" >
<import prefix="lib" ns="com.blakeley.xqut.test"
at="test/lib.xqy"/>
<namespace prefix="t" ns="test"/>
<variable symbol="TEST">xdmp:request-timestamp()</variable>
<variable symbol="SCHEMA">
xdmp:document-get(
concat(xdmp:modules-root(), "src/xqut.xsd"))
</variable>
</environment>
<setup>current-dateTime()</setup>
<setup>$TEST</setup>
<setup note="insert xqut schema, for validation tests">
xdmp:eval('
declare variable $SCHEMA external;
xdmp:document-insert("xqut.xsd", $SCHEMA)'
, (xs:QName('SCHEMA'), $SCHEMA),
&lt;options xmlns="xdmp:eval">
&lt;database>{ xdmp:schema-database() }&lt;/database>
&lt;/options>)
</setup>
<unit fatal="true" note="parse test">()</unit>
<unit result="-1" note="this test should fail">xdmp:random(10)</unit>
<unit note="validate schema">
<result xsi:type="xs:boolean">1</result>
<expr>
validate strict { $SCHEMA } instance of document-node()
</expr>
</unit>
<!-- TODO must find a way to allow xsi:type="xs:boolean" with this -->
<!--
<unit note="validate suite">
<result xsi:type="xs:boolean">1</result>
<expr>
validate strict {
xdmp:document-get(
concat(xdmp:modules-root(), 'test/test.xml')) }
instance of document-node()
</expr>
</unit>
-->
<unit note="database name" result="Documents">
xdmp:database-name(xdmp:database())
</unit>
<unit note="lib 1">
<expr>lib:one()</expr>
<result xsi:type="xs:integer">17</result>
</unit>
<unit note="lib 2">
<expr>
lib:two('foo')
</expr>
<result><foo xmlns=""/></result>
</unit>
<unit note="variable">
<expr>exists($TEST)</expr>
<result xsi:type="xs:boolean">1</result>
</unit>
<unit note="namespace declaration">
<expr>namespace-uri(element t:test { () })</expr>
<result xsi:type="xs:anyURI">test</result>
</unit>
<unit note="boundary-space">
<expr>element a { element b {} }</expr>
<result>
<a xmlns="">
<b/>
</a>
</result>
</unit>
<unit note="sequence">
<expr>1 to 3</expr>
<result>1</result>
<result>2</result>
<result>3</result>
</unit>
<unit note="cts:query with prefix anomaly">
<result>
<cts:element-query>
<cts:element xmlns:a="cts-query-test">a:title</cts:element>
<cts:word-query>
<cts:text xml:lang="en">bar</cts:text>
</cts:word-query>
</cts:element-query>
</result>
<expr>
<cts:element-query>
<cts:element xmlns:b="cts-query-test">b:title</cts:element>
<cts:word-query>
<cts:text xml:lang="en">bar</cts:text>
</cts:word-query>
</cts:element-query>
</expr>
</unit>
<unit note="unit-level user-name=nobody">
<environment user-name="nobody"/>
<expr>xdmp:get-current-user()</expr>
<result>nobody</result>
</unit>
<unit note="variable TEMP store" store="TEMP">
<expr>1</expr>
</unit>
<unit note="variable TEMP = 1">
<expr>$TEMP eq 1</expr>
<result xsi:type="xs:boolean">1</result>
</unit>
<teardown>xdmp:elapsed-time()</teardown>
</suite>