@@ -4,6 +4,62 @@ module namespace flwor="http://exist-db.org/xquery/test/flwor";
4
4
5
5
declare namespace test="http://exist-db.org/xquery/xqsuite" ;
6
6
7
+ declare variable $flwor:COLLECTION_CONFIG :=
8
+ <collection xmlns = "http://exist-db.org/collection-config/1.0" >
9
+ <index xmlns:xs = "http://www.w3.org/2001/XMLSchema" >
10
+ <fulltext default = "none" attributes = "false" />
11
+ <range>
12
+ <create qname = "place" >
13
+ <field name = "place-id" type = "xs:string" match = "@xml:id" />
14
+ <field name = "place-name" type = "xs:string" match = "placeName" />
15
+ </create>
16
+ </range>
17
+ </index>
18
+ </collection>;
19
+
20
+ declare variable $flwor:DATA :=
21
+ <listPlace>
22
+ <place xml:id = "warsaw" >
23
+ <placeName>Warsaw</placeName>
24
+ </place>
25
+ <place xml:id = "berlin" >
26
+ <placeName>Berlin</placeName>
27
+ </place>
28
+ </listPlace>;
29
+
30
+ declare variable $flwor:COLLECTION_NAME := "flwortest" ;
31
+ declare variable $flwor:COLLECTION := "/db/" || $flwor:COLLECTION_NAME;
32
+
33
+ declare
34
+ %test:setUp
35
+ function flwor:setup () {
36
+ xmldb:create-collection ("/db/system/config/db" , $flwor:COLLECTION_NAME),
37
+ xmldb:store ("/db/system/config/db/" || $flwor:COLLECTION_NAME, "collection.xconf" , $flwor:COLLECTION_CONFIG),
38
+ xmldb:create-collection ("/db" , $flwor:COLLECTION_NAME),
39
+ xmldb:store ($flwor:COLLECTION, "test.xml" , $flwor:DATA)
40
+ };
41
+
42
+ declare
43
+ %test:tearDown
44
+ function flwor:cleanup () {
45
+ xmldb:remove ($flwor:COLLECTION),
46
+ xmldb:remove ("/db/system/config/db/" || $flwor:COLLECTION_NAME)
47
+ };
48
+
49
+ declare function flwor:test ($name) {
50
+ collection ($flwor:COLLECTION)//place[placeName = $name]/string ()
51
+ };
52
+
53
+
54
+ declare
55
+ %test:assertEquals("Berlin" , "Berlin" )
56
+ function flwor:order-by-with-range () {
57
+ for $i in 1 to 2
58
+ order by $i
59
+ return
60
+ flwor:test ("Berlin" )
61
+ };
62
+
7
63
(: https://github.com/eXist-db/exist/issues/739#issuecomment-130997865 :)
8
64
declare
9
65
%test:assertEquals(1 , 2 , 1 , 2 , 3 , 1 , 2 , 3 , 4 )
@@ -78,3 +134,4 @@ function flwor:allowing-empty($n as xs:integer) {
78
134
where not ($x = 5 )
79
135
return concat ("[" , $x, "]" )
80
136
};
137
+
0 commit comments