Merge lp:~zorba-coders/zorba/markos_fots into lp:zorba

Proposed by Markos Zaharioudakis on 2013-02-25
Status: Merged
Approved by: Sorin Marian Nasoi on 2013-02-26
Approved revision: 11251
Merged at revision: 11259
Proposed branch: lp:~zorba-coders/zorba/markos_fots
Merge into: lp:zorba
Diff against target: 984 lines (+367/-192)
5 files modified
test/fots_driver/cli.xq (+1/-0)
test/fots_driver/environment.xq (+253/-136)
test/fots_driver/evaluate.xq (+91/-38)
test/fots_driver/feedback.xq (+4/-4)
test/fots_driver/fots-driver.xq (+18/-14)
To merge this branch: bzr merge lp:~zorba-coders/zorba/markos_fots
Reviewer Review Type Date Requested Status
Sorin Marian Nasoi 2013-02-26 Approve on 2013-02-26
Markos Zaharioudakis Approve on 2013-02-26
Review via email: mp+150278@code.launchpad.net

Commit message

comments + cosmetic changes in fots_driver/environment.xq

Description of the change

comments + cosmetic changes in fots_driver/environment.xq

To post a comment you must log in.
Zorba Build Bot (zorba-buildbot) wrote :

Attempt to merge into lp:zorba failed due to conflicts:

text conflict in test/fots_driver/fots-driver.xq

Zorba Build Bot (zorba-buildbot) wrote :

Attempt to merge into lp:zorba failed due to conflicts:

text conflict in test/fots_driver/evaluate.xq

Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job markos_fots-2013-02-26T06-32-45.444Z is finished. The final status was:

All tests succeeded!

Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 2 Pending.

review: Approve
review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job markos_fots-2013-02-26T08-48-42.786Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'test/fots_driver/cli.xq'
2--- test/fots_driver/cli.xq 2013-02-22 10:41:13 +0000
3+++ test/fots_driver/cli.xq 2013-02-26 06:33:21 +0000
4@@ -94,6 +94,7 @@
5 : Used by the run-test-sets, run-and-report, and report commands.
6 :)
7 declare variable $exceptedTestCases as xs:string* := (
8+ "fn-unparsed-text-lines-052",
9 "cbcl-subsequence-011",
10 "cbcl-subsequence-012",
11 "cbcl-subsequence-013",
12
13=== modified file 'test/fots_driver/environment.xq'
14--- test/fots_driver/environment.xq 2013-02-19 14:06:08 +0000
15+++ test/fots_driver/environment.xq 2013-02-26 06:33:21 +0000
16@@ -24,6 +24,7 @@
17
18 import module namespace xqxq =
19 "http://www.zorba-xquery.com/modules/xqxq";
20+
21 import module namespace util =
22 "http://www.zorba-xquery.com/fots-driver/util" at "util.xq";
23
24@@ -69,7 +70,8 @@
25
26
27 (:~
28- : Create the text for an XQuery version declaration, if needed.
29+ : Create the text for an XQuery version declaration that must be added
30+ : to a test-case query.
31 :
32 : @param $deps the dependencies of the test set and test case.
33 : @param $test the raw query text.
34@@ -107,7 +109,8 @@
35
36
37 (:~
38- : Retruns the text for the static-base-uri declarations.
39+ : Retruns the text for the static-base-uri declaration that must be added
40+ : to a test-case query.
41 :
42 : NOTE: at least one of $end and $envCase is the empty sequence.
43 :
44@@ -128,7 +131,8 @@
45
46
47 (:~
48- : Return the text for the default-element-namespace declaration, if needed.
49+ : Create the text for the default-element-namespace declaration that must be
50+ : added to a test-case query.
51 :
52 : NOTE: at least one of $end and $envCase is the empty sequence.
53 :
54@@ -150,7 +154,8 @@
55
56
57 (:~
58- : Retruns the text for the necessary namespace declarations.
59+ : Create the text for the necessary namespace declarations that must be added
60+ : to a test-case query.
61 :
62 : NOTE: at least one of $end and $envCase is the empty sequence.
63 :
64@@ -167,15 +172,19 @@
65 $test as xs:string
66 ) as xs:string?
67 {
68- string-join
69- (
70- for $ns in ($env/fots:namespace, $envCase/fots:namespace)
71- where not($ns[@prefix eq ""]) and
72- not(env:is-schema-prefix-bound($ns/@prefix, $test))
73- return concat('declare namespace ', $ns/@prefix, ' = "', $ns/@uri, '";')
74- ,
75- "&#xA;"
76- )
77+ if (($env/fots:namespace, $envCase/fots:namespace))
78+ then
79+ string-join
80+ (
81+ for $ns in ($env/fots:namespace, $envCase/fots:namespace)
82+ where not($ns[@prefix eq ""]) and
83+ not(env:is-schema-prefix-bound($ns/@prefix, $test))
84+ return concat('declare namespace ', $ns/@prefix, ' = "', $ns/@uri, '";')
85+ ,
86+ "&#xA;"
87+ )
88+ else
89+ ()
90 };
91
92
93@@ -193,7 +202,8 @@
94
95
96 (:~
97- : Add the decimal format declarations.
98+ : Create the text for the decimal format declarations that must be added
99+ : to a test-case query.
100 :
101 : @param $decimal-formats decimal formats.
102 : @return the decimal formats declarations.
103@@ -203,7 +213,8 @@
104 ) as xs:string*
105 {
106 if (empty($decimal-formats))
107- then ()
108+ then
109+ ()
110 else
111 for $tmp in $decimal-formats
112 let $default := if ($tmp/@name)
113@@ -247,8 +258,8 @@
114
115 (:~
116 : Create the text for all of the variable declarations that must be added to
117- : the text of a query. The required declarations are specified by the <param>
118- : and <source> subelements of the applicable <environment>.
119+ : the text of a test-case query. The required declarations are specified by
120+ : the <param> and <source> subelements of the applicable <environment>.
121 :
122 : NOTE: at least one of $end and $envCase is the empty sequence.
123 :
124@@ -256,8 +267,10 @@
125 : enviroment specified either at the test-set level or at the catalog
126 : level and is referenced by the test-case.
127 : @param $envCase the local environment of the test-case, if any.
128- : @param $envBaseURI the relative URI for the environment.
129- : @param $testSetBaseURI the URI of the test set.
130+ : @param $envBaseURI The absolute pathname of the directory containing the
131+ : file that defines the non-local environment.
132+ : @param $testSetBaseURI The absolute pathname of the directory containing the
133+ : test-set file.
134 : @return the text for the variable declarations.
135 :)
136 declare %ann:nondeterministic function env:add-var-decl(
137@@ -273,15 +286,15 @@
138 };
139
140
141-
142 declare %private function env:add-var-decls(
143 $env as element(fots:environment)?,
144 $envBaseURI as xs:anyURI
145 ) as xs:string?
146 {
147- string-join
148- (
149- (
150+ let $result :=
151+ string-join
152+ (
153+ (
154 for $param in $env/fots:param
155 where empty($param[@declared eq "true"])
156 return
157@@ -328,17 +341,54 @@
158 let $role := $source/@role
159 where starts-with($role,"$")
160 return concat("declare variable ", $role, " external;")
161- )
162- ,
163- " "
164- )
165+ )
166+ ,
167+ " "
168+ )
169+ return
170+ if ($result eq "")
171+ then ()
172+ else $result
173 };
174
175
176 (:~
177- : Returns the string for setting the context item if needed.
178- : @param $env environment.
179- : @param $envBaseURI test base URI of the environment.
180+ : If a test-case query TQ references a source doc via the context item, this
181+ : function creates and returns the xquery code for computing a value for the
182+ : context item and binding this value inside TQ. The result of this function
183+ : is added to the query FQ that will be evaluated via XQXQ by the fots test
184+ : driver. The function assumes that TQ will appear as a nested XQXQ query
185+ : within FQ, and that $queryID is the FQ variable storing the XQXQ query id
186+ : of TQ.
187+ :
188+ : If the source doc needs to be validated, the code created by this function
189+ : looks like this:
190+ :
191+ : variable $contextItemQuery := xqxq:prepare-main-module
192+ : (
193+ : '
194+ : import schema some-prefix = "some-URI";
195+ :
196+ : validate { doc("some-xml-file") }
197+ : ',
198+ : (), mapper:uri-mapper#2
199+ : );
200+ :
201+ : variable $contextItem := xqxq:evaluate($contextItemQuery);
202+ :
203+ : xqxq:bind-context-item($queryID, $contextItem);
204+ :
205+ : If no validation is required, the code created by this function looks like
206+ : this:
207+ :
208+ : variable $contextItem := doc("some-xml-file");
209+ :
210+ : xqxq:bind-context-item($queryID, $contextItem);
211+ :
212+ : @param $env The environment (local or non-local) that applies to the current
213+ : test case.
214+ : @param $envBaseURI The absolute pathname of the directory containing the
215+ : file that defines the environment.
216 : @return the string for setting the context item if needed.
217 :)
218 declare function env:set-context-item(
219@@ -347,14 +397,23 @@
220 ) as xs:string?
221 {
222 if (exists($env/fots:source[@role = "."]))
223- then string-join((env:declare-context-item($env, $envBaseURI),
224- 'xqxq:bind-context-item($queryID, $contextItem);')
225- ,"&#xA;")
226- else ()
227+ then
228+ string-join
229+ (
230+ (
231+ env:compute-context-item($env, $envBaseURI),
232+ "",
233+ 'xqxq:bind-context-item($queryID, $contextItem);'
234+ )
235+ ,
236+ "&#xA;"
237+ )
238+ else
239+ ()
240 };
241
242
243-declare %private function env:declare-context-item(
244+declare %private function env:compute-context-item(
245 $env as element(fots:environment)?,
246 $envBaseURI as xs:anyURI?
247 ) as xs:string
248@@ -362,23 +421,68 @@
249 let $ciURI := resolve-uri($env/fots:source[@role = "."]/@file, $envBaseURI)
250 return
251 if (empty($env/fots:source[@validation = "strict"]))
252- then concat('variable $contextItem := doc("', $ciURI, '");')
253- else string-join(
254- ("&#xA;",
255- "variable $contextItemQuery := xqxq:prepare-main-module('",
256- env:get-schema-import($env),
257- concat('validate { doc("', $ciURI, '")', "}',", " "),
258- "(), mapper:uri-mapper#2);",
259- "variable $contextItem := xqxq:evaluate($contextItemQuery);")
260- ,"&#xA;")
261+ then
262+ concat('variable $contextItem := doc("', $ciURI, '");')
263+ else
264+ string-join
265+ (
266+ (
267+ "&#xA;",
268+
269+ "variable $contextItemQuery := xqxq:prepare-main-module",
270+ "(",
271+ "'",
272+ env:get-schema-import($env),
273+ concat('validate { doc("', $ciURI, '")', " }"),
274+ "',",
275+ "(), mapper:uri-mapper#2",
276+ ");",
277+ "",
278+ "variable $contextItem := xqxq:evaluate($contextItemQuery);"
279+ )
280+ ,
281+ "&#xA;"
282+ )
283+};
284+
285+
286+declare %private function env:get-schema-import(
287+ $env as element(fots:environment)?
288+) as xs:string
289+{
290+ if (empty($env))
291+ then
292+ ""
293+ else
294+ let $namespace := $env/fots:namespace[@uri eq $env/fots:schema/@uri]
295+ let $prefix as xs:string := if (exists($namespace))
296+ then xs:string($namespace/@prefix)
297+ else "p"
298+ return
299+ if ($prefix eq "")
300+ then concat('import schema default element namespace "',
301+ $env/fots:schema/@uri,
302+ '";&#xA;')
303+ else concat('import schema namespace ',
304+ $prefix,
305+ ' = "',
306+ $env/fots:schema/@uri,
307+ '";&#xA;')
308 };
309
310
311 (:~
312- : Returns the strings for variable binding in XQXQ.
313+ : Creates the xquery code for assigning values to the external variables of
314+ : a nested XQXQ query. The nested XQXQ query is a test-case query TQ, and the
315+ : result of this function is added to the query FQ that will be evaluated via
316+ : XQXQ by the fots test driver. The function assumes that TQ will appear as a
317+ : nested XQXQ query within FQ, and that $queryID is the FQ variable storing
318+ : the XQXQ query id of TQ.
319 :
320- : @param $env the environment of the catalog/test-set (given with 'ref').
321- : @param $envBaseURI the relative URI for the environment.
322+ : @param $env The environment (local or non-local) that applies to the current
323+ : test case
324+ : @param $envBaseURI The absolute pathname of the directory containing the
325+ : file that defines the environment.
326 : @return the strings for variable binding in XQXQ.
327 :)
328 declare function env:set-variables(
329@@ -387,73 +491,47 @@
330 ) as xs:string?
331 {
332 if (empty($env))
333- then ()
334+ then
335+ ()
336 else
337- let $srcNames := for $source in $env/fots:source
338- where starts-with(data($source/@role),"$")
339- return substring-after(data($source/@role),"$"),
340- $srcValues := for $srcName in $srcNames
341- return concat('doc("',
342- resolve-uri($env/fots:source[@role = concat("$",$srcName)]/@file, $envBaseURI),
343- '")')
344- return
345- string-join(
346- (for $srcName in $srcNames
347- let $index := index-of($srcNames, $srcName)
348- return
349- concat('xqxq:bind-variable( $queryID, xs:QName("', $srcName, '")', ', ',
350- $srcValues[$index], ');'),
351-
352+ string-join
353+ (
354+ (
355+ for $src in $env/fots:source[starts-with(@role, "$")]
356+ return
357+ concat('xqxq:bind-variable($queryID, xs:QName("',
358+ substring-after($src/@role, "$"),
359+ '"), ',
360+ 'doc("',
361+ resolve-uri($src/@file, $envBaseURI),
362+ '"));')
363+ ,
364 for $param in $env/fots:param
365 let $select:= $param/@select
366- let $file := $env/fots:source[@uri = translate($select, "'", "")]/@file
367+ let $file := $env/fots:source[@uri eq translate($select, "'", "")]/@file
368 let $varValue := if (starts-with($select, "'") and
369- ends-with($select, "'") and
370- exists($file))
371- then concat('"',
372- resolve-uri($file, $envBaseURI),
373- '"')
374+ ends-with($select, "'") and
375+ exists($file))
376+ then concat('"', resolve-uri($file, $envBaseURI), '"')
377 else $select
378 let $varName := $param/@name
379- where (exists($select) and
380-(: if there is an attribute 'declared' set to true, this means that the variable
381- is declared within the 'test' itself :)
382- exists($param[@declared="true"]))
383+ where (exists($select) and exists($param[@declared eq "true"]))
384 return
385 concat('xqxq:bind-variable( $queryID, xs:QName("',
386 $param/@name,
387- '")', ', ',
388- $varValue, ');'))
389- , "&#xA;")
390-};
391-
392-
393-declare %private function env:get-schema-import(
394- $env as element(fots:environment)?
395-) as xs:string
396-{
397- if (empty($env))
398- then ""
399- else
400- let $namespace := $env/fots:namespace[@uri = data($env/fots:schema/@uri)]
401- let $prefix as xs:string := if (exists($namespace))
402- then xs:string(data($namespace/@prefix))
403- else "p"
404- return
405- if ($prefix = "")
406- then concat('import schema default element namespace "',
407- $env/fots:schema/@uri,
408- '";&#xA;')
409- else concat('import schema namespace ',
410- $prefix,
411- ' = "',
412- $env/fots:schema/@uri,
413- '";&#xA;')
414+ '"), ',
415+ $varValue,
416+ ');')
417+ )
418+ ,
419+ "&#xA;"
420+ )
421 };
422
423
424 (:~
425 : Returns the XQXQ URL resolver declaration.
426+ :
427 : @param $case the test case.
428 : @param $env the environment.
429 : @param $envBaseURI URI of the environment.
430@@ -471,45 +549,83 @@
431 let $resources := $env/fots:resource
432 return
433 if (empty($modules) and empty($resources))
434- then ()
435- else string-join(
436- ("declare function resolver:url-resolver($namespace as xs:string, $entity as xs:string) {",
437- "switch($entity)",
438- if (exists($modules))
439- then string-join(("case 'module'",
440- " return switch($namespace)",
441- for $module in $modules
442- return concat(" case '",
443- data($module/@uri),
444- "' return unparsed-text('",
445- resolve-uri($module/@file, $testSetBaseURI),
446- "') "),
447- " default return ()"),
448- "&#xA;")
449- else (),
450- if (exists($resources))
451 then
452- string-join(("case ''",
453- " return switch($namespace)",
454- for $resource in $resources
455- return concat(" case '",
456- data($resource/@uri),
457- "' return unparsed-text('",
458- resolve-uri($resource/@file, $envBaseURI),
459- "'",
460- if (exists($resource/@encoding))
461- then concat (",'",
462- data($resource/@encoding),
463- "'")
464- else (),
465- ") "),
466- " default return ()")
467- ,"&#xA;")
468- else ()
469- , "default return ()","};"),
470- "&#xA;")
471+ {
472+ ()
473+ }
474+ else
475+ {
476+ string-join
477+ (
478+ (
479+ "declare function resolver:url-resolver($namespace as xs:string, $entity as xs:string)",
480+ "{",
481+ "switch($entity)",
482+
483+ if (exists($modules))
484+ then
485+ {
486+ string-join
487+ (
488+ (
489+ "case 'module'",
490+ " return switch($namespace)",
491+
492+ for $module in $modules
493+ return concat(" case '",
494+ data($module/@uri),
495+ "' return unparsed-text('",
496+ resolve-uri($module/@file, $testSetBaseURI),
497+ "') "),
498+
499+ " default return ()"
500+ )
501+ ,"&#xA;"
502+ )
503+ }
504+ else
505+ {
506+ ()
507+ },
508+
509+ if (exists($resources))
510+ then
511+ {
512+ string-join
513+ (
514+ (
515+ "case ''",
516+ " return switch($namespace)",
517+
518+ for $resource in $resources
519+ return concat(" case '",
520+ data($resource/@uri),
521+ "' return unparsed-text('",
522+ resolve-uri($resource/@file, $envBaseURI),
523+ "'",
524+ if (exists($resource/@encoding))
525+ then concat (",'", data($resource/@encoding), "'")
526+ else (),
527+ ") "),
528+
529+ " default return ()"
530+ )
531+ ,"&#xA;"
532+ )
533+ }
534+ else
535+ {
536+ ()
537+ },
538+
539+ "default return ()","};"
540+ )
541+ ,"&#xA;"
542+ )
543+ }
544 };
545
546+
547 (:~
548 : Returns the XQXQ URL mapper declaration.
549 : @param $case the test case.
550@@ -556,6 +672,7 @@
551 "&#xA;")
552 };
553
554+
555 (:~
556 : Checks that a set of dependencies (associated with some test-set or test-case)
557 : are met by Zorba's capabilities and implementation-defined features (as
558
559=== modified file 'test/fots_driver/evaluate.xq'
560--- test/fots_driver/evaluate.xq 2013-02-25 15:39:39 +0000
561+++ test/fots_driver/evaluate.xq 2013-02-26 06:33:21 +0000
562@@ -27,16 +27,19 @@
563
564 import module namespace xqxq =
565 "http://www.zorba-xquery.com/modules/xqxq";
566+
567 import module namespace schema =
568 "http://www.zorba-xquery.com/modules/schema";
569
570 import module namespace fots-err =
571 "http://www.zorba-xquery.com/fots-driver/errors" at "errors.xq";
572+
573 import module namespace util =
574 "http://www.zorba-xquery.com/fots-driver/util" at "util.xq";
575
576 declare namespace err =
577 "http://www.w3.org/2005/xqt-errors";
578+
579 declare namespace fots =
580 "http://www.w3.org/2010/09/qt-fots-catalog";
581
582@@ -76,6 +79,7 @@
583 </fots:info>
584 };
585
586+
587 (:~
588 : Checks if the error found matches the expected error (if any).
589 : @param $result actual result.
590@@ -119,6 +123,7 @@
591 </fots:info>
592 };
593
594+
595 declare %private %ann:sequential function eval:error-code(
596 $code as xs:QName?,
597 $errorDescription as xs:string?,
598@@ -153,6 +158,7 @@
599 $errorDescription)
600 };
601
602+
603 declare %private %ann:sequential function eval:check-assertion(
604 $result as item()*,
605 $expResult as element(),
606@@ -162,7 +168,8 @@
607 ) as xs:string*
608 {
609 let $test := local-name($expResult)
610- return switch($test)
611+ return
612+ switch($test)
613 case 'all-of'
614 return eval:assert-all-of($result,
615 $expResult,
616@@ -176,43 +183,44 @@
617 $errorDescription,
618 $testSetBaseURI)
619 case 'assert'
620- return eval:assert($result,
621- $expResult)
622+ return eval:assert($result, $expResult)
623+
624 case 'assert-count'
625- return eval:assert-count($result,
626- $expResult)
627+ return eval:assert-count($result, $expResult)
628+
629 case 'assert-deep-eq'
630- return eval:assert-deep-eq($result,
631- $expResult)
632+ return eval:assert-deep-eq($result, $expResult)
633+
634 case 'assert-empty'
635 return eval:assert-empty($result)
636+
637 case 'assert-eq'
638- return eval:assert-eq($result,
639- $expResult)
640+ return eval:assert-eq($result, $expResult)
641+
642 case 'assert-false'
643 return eval:assert-false($result)
644+
645 case 'assert-permutation'
646- return eval:assert-permutation($result,
647- $expResult)
648+ return eval:assert-permutation($result, $expResult)
649+
650 case 'assert-xml'
651- return eval:assert-xml($result,
652- $expResult,
653- $testSetBaseURI)
654+ return eval:assert-xml($result, $expResult, $testSetBaseURI)
655+
656 case 'assert-serialization-error'
657- return eval:assert-serialization-error($result,
658- $expResult,
659- $testSetBaseURI)
660+ return eval:assert-serialization-error($result, $expResult, $testSetBaseURI)
661+
662 case 'assert-string-value'
663- return eval:assert-string-value($result,
664- $expResult)
665+ return eval:assert-string-value($result, $expResult)
666+
667 case 'assert-true'
668 return eval:assert-true($result)
669+
670 case 'assert-type'
671- return eval:assert-type($result,
672- $expResult)
673+ return eval:assert-type($result, $expResult)
674+
675 case 'serialization-matches'
676- return eval:serialization-matches($result,
677- $expResult)
678+ return eval:serialization-matches($result, $expResult)
679+
680 case 'error'
681 return eval:error($result,
682 $expResult,
683@@ -224,7 +232,10 @@
684 "&#xA;The requested assertion type is not implemented.")
685 };
686
687-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_any-of :)
688+
689+(:
690+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_any-of
691+ :)
692 declare %private %ann:sequential function eval:assert-any-of(
693 $result as item()*,
694 $expResult as element(),
695@@ -248,7 +259,10 @@
696 string-join(util:serialize-result($results/data(item)), ' '))
697 };
698
699-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_all-of :)
700+
701+(:
702+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_all-of
703+ :)
704 declare %private %ann:sequential function eval:assert-all-of(
705 $result as item()*,
706 $expResult as element(),
707@@ -265,7 +279,10 @@
708 $baseURI)
709 };
710
711-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert :)
712+
713+(:
714+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert
715+ :)
716 declare %private %ann:sequential function eval:assert(
717 $result as item()*,
718 $expResult as element()
719@@ -295,7 +312,10 @@
720 }
721 };
722
723-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-count :)
724+
725+(:
726+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-count
727+ :)
728 declare %private function eval:assert-count(
729 $result as item()*,
730 $expResult as element()
731@@ -306,7 +326,10 @@
732 else "'assert-count' returned: actual number of items is different than the expected number of items."
733 };
734
735-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-deep-eq :)
736+
737+(:
738+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-deep-eq
739+ :)
740 declare %private %ann:sequential function eval:assert-deep-eq(
741 $result as item()*,
742 $expResult as element()
743@@ -336,7 +359,10 @@
744 }
745 };
746
747-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-empty :)
748+
749+(:
750+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-empty
751+ :)
752 declare %private function eval:assert-empty(
753 $result as item()*
754 ) as xs:string?
755@@ -346,7 +372,10 @@
756 else "'assert-empty' returned: result is not empty as expected."
757 };
758
759-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-eq :)
760+
761+(:
762+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-eq
763+ :)
764 declare %private %ann:sequential function eval:assert-eq(
765 $result as item()*,
766 $expResult as element()
767@@ -385,7 +414,10 @@
768 }
769 };
770
771-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-true :)
772+
773+(:
774+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-true
775+ :)
776 declare %private function eval:assert-true(
777 $result as item()*
778 ) as xs:string?
779@@ -395,7 +427,10 @@
780 else "'assert-true' returned: query doesn't evaluate to true."
781 };
782
783-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-false :)
784+
785+(:
786+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-false
787+ :)
788 declare %private function eval:assert-false(
789 $result as item()*
790 ) as xs:string?
791@@ -405,7 +440,10 @@
792 else "'assert-false' returned: query doesn't evaluate to false."
793 };
794
795-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-permutation :)
796+
797+(:
798+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-permutation
799+ :)
800 declare %private %ann:sequential function eval:assert-permutation(
801 $result as item()*,
802 $expResult as element()
803@@ -434,7 +472,10 @@
804 }
805 };
806
807-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-xml :)
808+
809+(:
810+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-xml
811+ :)
812 declare %private function eval:assert-xml(
813 $result as item()*,
814 $expResult as element(),
815@@ -458,7 +499,10 @@
816 }
817 };
818
819-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-serialization-error :)
820+
821+(:
822+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-serialization-error
823+ :)
824 declare %private %ann:sequential function eval:assert-serialization-error(
825 $result as item()*,
826 $expResult as element(),
827@@ -480,7 +524,10 @@
828 }
829 };
830
831-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_serialization-matches :)
832+
833+(:
834+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_serialization-matches
835+ :)
836 declare %private function eval:serialization-matches(
837 $result as item()*,
838 $expResult as element()
839@@ -512,7 +559,10 @@
840 }
841 };
842
843-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-string-value :)
844+
845+(:
846+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-string-value
847+ :)
848 declare %private function eval:assert-string-value(
849 $result as item()*,
850 $expResult as element()
851@@ -536,7 +586,10 @@
852 }
853 };
854
855-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-type :)
856+
857+(:
858+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-type
859+ :)
860 declare %private %ann:sequential function eval:assert-type(
861 $result as item()*,
862 $expResult as element()
863
864=== modified file 'test/fots_driver/feedback.xq'
865--- test/fots_driver/feedback.xq 2013-02-22 11:58:13 +0000
866+++ test/fots_driver/feedback.xq 2013-02-26 06:33:21 +0000
867@@ -207,8 +207,8 @@
868 variable $info := 'Test case passed but it is marked with EXPECTED_FOTS_FAILURE in test/fots/CMakeLists.txt';
869 variable $status := 'fail';
870
871- (:if ($verbose)
872- then:)
873+ if ($verbose)
874+ then
875 {
876 {
877 (insert node attribute result{$status} as last into $case,
878@@ -231,14 +231,14 @@
879
880 $case
881 }
882- } (:
883+ }
884 else if ($expectedFailure)
885 then <fots:test-case name="{data($case/@name)}"
886 result="{$status}"
887 comment="{$info}"/>
888
889 else <fots:test-case name="{data($case/@name)}"
890- result="{$status}"/>:)
891+ result="{$status}"/>
892 };
893
894
895
896=== modified file 'test/fots_driver/fots-driver.xq'
897--- test/fots_driver/fots-driver.xq 2013-02-25 15:39:39 +0000
898+++ test/fots_driver/fots-driver.xq 2013-02-26 06:33:21 +0000
899@@ -58,7 +58,7 @@
900
901 declare namespace op = "http://www.zorba-xquery.com/options/features";
902 declare namespace f = "http://www.zorba-xquery.com/features";
903-declare option op:disable "f:trace";
904+(:declare option op:disable "f:trace";:)
905
906 (:~
907 : Returns the names of all qualifying test sets.
908@@ -431,10 +431,8 @@
909 }
910 };
911
912+
913 (:~
914- : This function is just a thin wrapper over the driver:run() function. See
915- : driver:run() for more info.
916- :
917 : Process a specified test set and report the outcome for each containing
918 : test case.
919 :
920@@ -885,11 +883,13 @@
921
922
923 (:~
924- : Creates the complete query that will be evaluated via XQXQ by the fots
925- : test driver.
926+ : Creates the text for the complete query FQ that will be evaluated via XQXQ
927+ : by the fots test driver. The actual test-case query TQ will be evaluated as
928+ : a nested XQXQ query within FQ. FQ may contain additional nested XQXQ queries,
929+ : for example to compute values for external variables declared in TQ.
930 :
931- : @param $queryText the test-case/test after all the additional prolog
932- : statements were added.
933+ : @param $queryText the text for the test-case query TQ. It is content of
934+ : <test-case>/test augmented with all the necessary prolog statements.
935 : @param $case the test case.
936 : @param $env the environment.
937 : @param $envBaseURI URI of the environment.
938@@ -919,15 +919,20 @@
939 (
940 "",
941 "import module namespace xqxq = 'http://www.zorba-xquery.com/modules/xqxq';",
942+
943 if (exists($resolver))
944 then "declare namespace resolver = 'http://www.zorba-xquery.com/modules/xqxq/url-resolver';"
945 else (),
946+
947 if (exists($mapper))
948 then "declare namespace mapper = 'http://www.zorba-xquery.com/modules/xqxq/uri-mapper';"
949 else (),
950+
951 if (exists($resolver) or exists($mapper)) then $env:hof else (),
952 "",
953+
954 if (exists($resolver)) then ($resolver, "") else (),
955+
956 if (exists($mapper)) then ($mapper, "") else (),
957
958 (:
959@@ -951,7 +956,7 @@
960 let $escAposQueryText := replace($queryText,"'","''")
961 let $escAmpQueryText := replace($escAposQueryText, '&amp;', '&amp;amp;')
962 return concat(
963- "variable $queryID := xqxq:prepare-main-module(",
964+ "variable $queryID := xqxq:prepare-main-module&#xA;(",
965 "&#xA;",
966 "'",
967 "&#xA;",
968@@ -961,12 +966,11 @@
969 "&#xA;",
970 if (exists($resolver))
971 then if(exists($mapper))
972- then ", resolver:url-resolver#2, mapper:uri-mapper#2);"
973- else ", resolver:url-resolver#2, ());"
974+ then ", resolver:url-resolver#2, mapper:uri-mapper#2&#xA;);"
975+ else ", resolver:url-resolver#2, ()&#xA;);"
976 else if(exists($mapper))
977- then ", (), mapper:uri-mapper#2);"
978- else");
979- "),
980+ then ", (), mapper:uri-mapper#2&#xA;);"
981+ else "&#xA;);"),
982
983 env:set-context-item($env, $envBaseURI),
984 env:set-context-item($case/fots:environment, $testSetBaseURI),

Subscribers

People subscribed via source and target branches