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

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Sorin Marian Nasoi
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 Approve
Markos Zaharioudakis Approve
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.
Revision history for this message
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

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

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

text conflict in test/fots_driver/evaluate.xq

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
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!

Revision history for this message
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.

Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
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
=== modified file 'test/fots_driver/cli.xq'
--- test/fots_driver/cli.xq 2013-02-22 10:41:13 +0000
+++ test/fots_driver/cli.xq 2013-02-26 06:33:21 +0000
@@ -94,6 +94,7 @@
94 : Used by the run-test-sets, run-and-report, and report commands.94 : Used by the run-test-sets, run-and-report, and report commands.
95 :)95 :)
96declare variable $exceptedTestCases as xs:string* := (96declare variable $exceptedTestCases as xs:string* := (
97 "fn-unparsed-text-lines-052",
97 "cbcl-subsequence-011",98 "cbcl-subsequence-011",
98 "cbcl-subsequence-012",99 "cbcl-subsequence-012",
99 "cbcl-subsequence-013",100 "cbcl-subsequence-013",
100101
=== modified file 'test/fots_driver/environment.xq'
--- test/fots_driver/environment.xq 2013-02-19 14:06:08 +0000
+++ test/fots_driver/environment.xq 2013-02-26 06:33:21 +0000
@@ -24,6 +24,7 @@
2424
25import module namespace xqxq =25import module namespace xqxq =
26 "http://www.zorba-xquery.com/modules/xqxq";26 "http://www.zorba-xquery.com/modules/xqxq";
27
27import module namespace util =28import module namespace util =
28 "http://www.zorba-xquery.com/fots-driver/util" at "util.xq";29 "http://www.zorba-xquery.com/fots-driver/util" at "util.xq";
2930
@@ -69,7 +70,8 @@
6970
7071
71(:~72(:~
72 : Create the text for an XQuery version declaration, if needed.73 : Create the text for an XQuery version declaration that must be added
74 : to a test-case query.
73 :75 :
74 : @param $deps the dependencies of the test set and test case.76 : @param $deps the dependencies of the test set and test case.
75 : @param $test the raw query text.77 : @param $test the raw query text.
@@ -107,7 +109,8 @@
107109
108110
109(:~111(:~
110 : Retruns the text for the static-base-uri declarations.112 : Retruns the text for the static-base-uri declaration that must be added
113 : to a test-case query.
111 :114 :
112 : NOTE: at least one of $end and $envCase is the empty sequence.115 : NOTE: at least one of $end and $envCase is the empty sequence.
113 :116 :
@@ -128,7 +131,8 @@
128131
129132
130(:~133(:~
131 : Return the text for the default-element-namespace declaration, if needed.134 : Create the text for the default-element-namespace declaration that must be
135 : added to a test-case query.
132 :136 :
133 : NOTE: at least one of $end and $envCase is the empty sequence.137 : NOTE: at least one of $end and $envCase is the empty sequence.
134 :138 :
@@ -150,7 +154,8 @@
150154
151155
152(:~156(:~
153 : Retruns the text for the necessary namespace declarations.157 : Create the text for the necessary namespace declarations that must be added
158 : to a test-case query.
154 :159 :
155 : NOTE: at least one of $end and $envCase is the empty sequence.160 : NOTE: at least one of $end and $envCase is the empty sequence.
156 :161 :
@@ -167,15 +172,19 @@
167 $test as xs:string172 $test as xs:string
168) as xs:string?173) as xs:string?
169{174{
170 string-join175 if (($env/fots:namespace, $envCase/fots:namespace))
171 (176 then
172 for $ns in ($env/fots:namespace, $envCase/fots:namespace)177 string-join
173 where not($ns[@prefix eq ""]) and178 (
174 not(env:is-schema-prefix-bound($ns/@prefix, $test))179 for $ns in ($env/fots:namespace, $envCase/fots:namespace)
175 return concat('declare namespace ', $ns/@prefix, ' = "', $ns/@uri, '";')180 where not($ns[@prefix eq ""]) and
176 ,181 not(env:is-schema-prefix-bound($ns/@prefix, $test))
177 "&#xA;"182 return concat('declare namespace ', $ns/@prefix, ' = "', $ns/@uri, '";')
178 )183 ,
184 "&#xA;"
185 )
186 else
187 ()
179};188};
180189
181190
@@ -193,7 +202,8 @@
193202
194203
195(:~204(:~
196 : Add the decimal format declarations.205 : Create the text for the decimal format declarations that must be added
206 : to a test-case query.
197 :207 :
198 : @param $decimal-formats decimal formats.208 : @param $decimal-formats decimal formats.
199 : @return the decimal formats declarations.209 : @return the decimal formats declarations.
@@ -203,7 +213,8 @@
203) as xs:string*213) as xs:string*
204{214{
205 if (empty($decimal-formats))215 if (empty($decimal-formats))
206 then ()216 then
217 ()
207 else218 else
208 for $tmp in $decimal-formats219 for $tmp in $decimal-formats
209 let $default := if ($tmp/@name)220 let $default := if ($tmp/@name)
@@ -247,8 +258,8 @@
247258
248(:~259(:~
249 : Create the text for all of the variable declarations that must be added to260 : Create the text for all of the variable declarations that must be added to
250 : the text of a query. The required declarations are specified by the <param>261 : the text of a test-case query. The required declarations are specified by
251 : and <source> subelements of the applicable <environment>.262 : the <param> and <source> subelements of the applicable <environment>.
252 :263 :
253 : NOTE: at least one of $end and $envCase is the empty sequence.264 : NOTE: at least one of $end and $envCase is the empty sequence.
254 :265 :
@@ -256,8 +267,10 @@
256 : enviroment specified either at the test-set level or at the catalog267 : enviroment specified either at the test-set level or at the catalog
257 : level and is referenced by the test-case.268 : level and is referenced by the test-case.
258 : @param $envCase the local environment of the test-case, if any.269 : @param $envCase the local environment of the test-case, if any.
259 : @param $envBaseURI the relative URI for the environment.270 : @param $envBaseURI The absolute pathname of the directory containing the
260 : @param $testSetBaseURI the URI of the test set.271 : file that defines the non-local environment.
272 : @param $testSetBaseURI The absolute pathname of the directory containing the
273 : test-set file.
261 : @return the text for the variable declarations.274 : @return the text for the variable declarations.
262 :)275 :)
263declare %ann:nondeterministic function env:add-var-decl(276declare %ann:nondeterministic function env:add-var-decl(
@@ -273,15 +286,15 @@
273};286};
274287
275288
276
277declare %private function env:add-var-decls(289declare %private function env:add-var-decls(
278 $env as element(fots:environment)?,290 $env as element(fots:environment)?,
279 $envBaseURI as xs:anyURI291 $envBaseURI as xs:anyURI
280) as xs:string?292) as xs:string?
281{293{
282 string-join294 let $result :=
283 (295 string-join
284 (296 (
297 (
285 for $param in $env/fots:param298 for $param in $env/fots:param
286 where empty($param[@declared eq "true"])299 where empty($param[@declared eq "true"])
287 return300 return
@@ -328,17 +341,54 @@
328 let $role := $source/@role341 let $role := $source/@role
329 where starts-with($role,"$")342 where starts-with($role,"$")
330 return concat("declare variable ", $role, " external;")343 return concat("declare variable ", $role, " external;")
331 )344 )
332 ,345 ,
333 " "346 " "
334 )347 )
348 return
349 if ($result eq "")
350 then ()
351 else $result
335};352};
336353
337354
338(:~355(:~
339 : Returns the string for setting the context item if needed.356 : If a test-case query TQ references a source doc via the context item, this
340 : @param $env environment.357 : function creates and returns the xquery code for computing a value for the
341 : @param $envBaseURI test base URI of the environment.358 : context item and binding this value inside TQ. The result of this function
359 : is added to the query FQ that will be evaluated via XQXQ by the fots test
360 : driver. The function assumes that TQ will appear as a nested XQXQ query
361 : within FQ, and that $queryID is the FQ variable storing the XQXQ query id
362 : of TQ.
363 :
364 : If the source doc needs to be validated, the code created by this function
365 : looks like this:
366 :
367 : variable $contextItemQuery := xqxq:prepare-main-module
368 : (
369 : '
370 : import schema some-prefix = "some-URI";
371 :
372 : validate { doc("some-xml-file") }
373 : ',
374 : (), mapper:uri-mapper#2
375 : );
376 :
377 : variable $contextItem := xqxq:evaluate($contextItemQuery);
378 :
379 : xqxq:bind-context-item($queryID, $contextItem);
380 :
381 : If no validation is required, the code created by this function looks like
382 : this:
383 :
384 : variable $contextItem := doc("some-xml-file");
385 :
386 : xqxq:bind-context-item($queryID, $contextItem);
387 :
388 : @param $env The environment (local or non-local) that applies to the current
389 : test case.
390 : @param $envBaseURI The absolute pathname of the directory containing the
391 : file that defines the environment.
342 : @return the string for setting the context item if needed.392 : @return the string for setting the context item if needed.
343 :)393 :)
344declare function env:set-context-item(394declare function env:set-context-item(
@@ -347,14 +397,23 @@
347) as xs:string?397) as xs:string?
348{398{
349 if (exists($env/fots:source[@role = "."]))399 if (exists($env/fots:source[@role = "."]))
350 then string-join((env:declare-context-item($env, $envBaseURI),400 then
351 'xqxq:bind-context-item($queryID, $contextItem);')401 string-join
352 ,"&#xA;")402 (
353 else ()403 (
404 env:compute-context-item($env, $envBaseURI),
405 "",
406 'xqxq:bind-context-item($queryID, $contextItem);'
407 )
408 ,
409 "&#xA;"
410 )
411 else
412 ()
354};413};
355414
356415
357declare %private function env:declare-context-item(416declare %private function env:compute-context-item(
358 $env as element(fots:environment)?,417 $env as element(fots:environment)?,
359 $envBaseURI as xs:anyURI?418 $envBaseURI as xs:anyURI?
360) as xs:string419) as xs:string
@@ -362,23 +421,68 @@
362 let $ciURI := resolve-uri($env/fots:source[@role = "."]/@file, $envBaseURI)421 let $ciURI := resolve-uri($env/fots:source[@role = "."]/@file, $envBaseURI)
363 return422 return
364 if (empty($env/fots:source[@validation = "strict"]))423 if (empty($env/fots:source[@validation = "strict"]))
365 then concat('variable $contextItem := doc("', $ciURI, '");')424 then
366 else string-join(425 concat('variable $contextItem := doc("', $ciURI, '");')
367 ("&#xA;",426 else
368 "variable $contextItemQuery := xqxq:prepare-main-module('",427 string-join
369 env:get-schema-import($env),428 (
370 concat('validate { doc("', $ciURI, '")', "}',", " "),429 (
371 "(), mapper:uri-mapper#2);",430 "&#xA;",
372 "variable $contextItem := xqxq:evaluate($contextItemQuery);")431
373 ,"&#xA;")432 "variable $contextItemQuery := xqxq:prepare-main-module",
433 "(",
434 "'",
435 env:get-schema-import($env),
436 concat('validate { doc("', $ciURI, '")', " }"),
437 "',",
438 "(), mapper:uri-mapper#2",
439 ");",
440 "",
441 "variable $contextItem := xqxq:evaluate($contextItemQuery);"
442 )
443 ,
444 "&#xA;"
445 )
446};
447
448
449declare %private function env:get-schema-import(
450 $env as element(fots:environment)?
451) as xs:string
452{
453 if (empty($env))
454 then
455 ""
456 else
457 let $namespace := $env/fots:namespace[@uri eq $env/fots:schema/@uri]
458 let $prefix as xs:string := if (exists($namespace))
459 then xs:string($namespace/@prefix)
460 else "p"
461 return
462 if ($prefix eq "")
463 then concat('import schema default element namespace "',
464 $env/fots:schema/@uri,
465 '";&#xA;')
466 else concat('import schema namespace ',
467 $prefix,
468 ' = "',
469 $env/fots:schema/@uri,
470 '";&#xA;')
374};471};
375472
376473
377(:~474(:~
378 : Returns the strings for variable binding in XQXQ.475 : Creates the xquery code for assigning values to the external variables of
476 : a nested XQXQ query. The nested XQXQ query is a test-case query TQ, and the
477 : result of this function is added to the query FQ that will be evaluated via
478 : XQXQ by the fots test driver. The function assumes that TQ will appear as a
479 : nested XQXQ query within FQ, and that $queryID is the FQ variable storing
480 : the XQXQ query id of TQ.
379 :481 :
380 : @param $env the environment of the catalog/test-set (given with 'ref').482 : @param $env The environment (local or non-local) that applies to the current
381 : @param $envBaseURI the relative URI for the environment.483 : test case
484 : @param $envBaseURI The absolute pathname of the directory containing the
485 : file that defines the environment.
382 : @return the strings for variable binding in XQXQ.486 : @return the strings for variable binding in XQXQ.
383 :)487 :)
384declare function env:set-variables(488declare function env:set-variables(
@@ -387,73 +491,47 @@
387) as xs:string?491) as xs:string?
388{492{
389 if (empty($env))493 if (empty($env))
390 then ()494 then
495 ()
391 else496 else
392 let $srcNames := for $source in $env/fots:source497 string-join
393 where starts-with(data($source/@role),"$")498 (
394 return substring-after(data($source/@role),"$"),499 (
395 $srcValues := for $srcName in $srcNames500 for $src in $env/fots:source[starts-with(@role, "$")]
396 return concat('doc("',501 return
397 resolve-uri($env/fots:source[@role = concat("$",$srcName)]/@file, $envBaseURI),502 concat('xqxq:bind-variable($queryID, xs:QName("',
398 '")')503 substring-after($src/@role, "$"),
399 return504 '"), ',
400 string-join(505 'doc("',
401 (for $srcName in $srcNames506 resolve-uri($src/@file, $envBaseURI),
402 let $index := index-of($srcNames, $srcName)507 '"));')
403 return508 ,
404 concat('xqxq:bind-variable( $queryID, xs:QName("', $srcName, '")', ', ',
405 $srcValues[$index], ');'),
406
407 for $param in $env/fots:param509 for $param in $env/fots:param
408 let $select:= $param/@select510 let $select:= $param/@select
409 let $file := $env/fots:source[@uri = translate($select, "'", "")]/@file511 let $file := $env/fots:source[@uri eq translate($select, "'", "")]/@file
410 let $varValue := if (starts-with($select, "'") and512 let $varValue := if (starts-with($select, "'") and
411 ends-with($select, "'") and513 ends-with($select, "'") and
412 exists($file))514 exists($file))
413 then concat('"',515 then concat('"', resolve-uri($file, $envBaseURI), '"')
414 resolve-uri($file, $envBaseURI),
415 '"')
416 else $select516 else $select
417 let $varName := $param/@name517 let $varName := $param/@name
418 where (exists($select) and518 where (exists($select) and exists($param[@declared eq "true"]))
419(: if there is an attribute 'declared' set to true, this means that the variable
420 is declared within the 'test' itself :)
421 exists($param[@declared="true"]))
422 return519 return
423 concat('xqxq:bind-variable( $queryID, xs:QName("',520 concat('xqxq:bind-variable( $queryID, xs:QName("',
424 $param/@name,521 $param/@name,
425 '")', ', ',522 '"), ',
426 $varValue, ');'))523 $varValue,
427 , "&#xA;")524 ');')
428};525 )
429526 ,
430527 "&#xA;"
431declare %private function env:get-schema-import(528 )
432 $env as element(fots:environment)?
433) as xs:string
434{
435 if (empty($env))
436 then ""
437 else
438 let $namespace := $env/fots:namespace[@uri = data($env/fots:schema/@uri)]
439 let $prefix as xs:string := if (exists($namespace))
440 then xs:string(data($namespace/@prefix))
441 else "p"
442 return
443 if ($prefix = "")
444 then concat('import schema default element namespace "',
445 $env/fots:schema/@uri,
446 '";&#xA;')
447 else concat('import schema namespace ',
448 $prefix,
449 ' = "',
450 $env/fots:schema/@uri,
451 '";&#xA;')
452};529};
453530
454531
455(:~532(:~
456 : Returns the XQXQ URL resolver declaration.533 : Returns the XQXQ URL resolver declaration.
534 :
457 : @param $case the test case.535 : @param $case the test case.
458 : @param $env the environment.536 : @param $env the environment.
459 : @param $envBaseURI URI of the environment.537 : @param $envBaseURI URI of the environment.
@@ -471,45 +549,83 @@
471 let $resources := $env/fots:resource549 let $resources := $env/fots:resource
472 return550 return
473 if (empty($modules) and empty($resources))551 if (empty($modules) and empty($resources))
474 then ()
475 else string-join(
476 ("declare function resolver:url-resolver($namespace as xs:string, $entity as xs:string) {",
477 "switch($entity)",
478 if (exists($modules))
479 then string-join(("case 'module'",
480 " return switch($namespace)",
481 for $module in $modules
482 return concat(" case '",
483 data($module/@uri),
484 "' return unparsed-text('",
485 resolve-uri($module/@file, $testSetBaseURI),
486 "') "),
487 " default return ()"),
488 "&#xA;")
489 else (),
490 if (exists($resources))
491 then552 then
492 string-join(("case ''",553 {
493 " return switch($namespace)",554 ()
494 for $resource in $resources555 }
495 return concat(" case '",556 else
496 data($resource/@uri),557 {
497 "' return unparsed-text('",558 string-join
498 resolve-uri($resource/@file, $envBaseURI),559 (
499 "'",560 (
500 if (exists($resource/@encoding))561 "declare function resolver:url-resolver($namespace as xs:string, $entity as xs:string)",
501 then concat (",'",562 "{",
502 data($resource/@encoding),563 "switch($entity)",
503 "'")564
504 else (),565 if (exists($modules))
505 ") "),566 then
506 " default return ()")567 {
507 ,"&#xA;")568 string-join
508 else ()569 (
509 , "default return ()","};"),570 (
510 "&#xA;")571 "case 'module'",
572 " return switch($namespace)",
573
574 for $module in $modules
575 return concat(" case '",
576 data($module/@uri),
577 "' return unparsed-text('",
578 resolve-uri($module/@file, $testSetBaseURI),
579 "') "),
580
581 " default return ()"
582 )
583 ,"&#xA;"
584 )
585 }
586 else
587 {
588 ()
589 },
590
591 if (exists($resources))
592 then
593 {
594 string-join
595 (
596 (
597 "case ''",
598 " return switch($namespace)",
599
600 for $resource in $resources
601 return concat(" case '",
602 data($resource/@uri),
603 "' return unparsed-text('",
604 resolve-uri($resource/@file, $envBaseURI),
605 "'",
606 if (exists($resource/@encoding))
607 then concat (",'", data($resource/@encoding), "'")
608 else (),
609 ") "),
610
611 " default return ()"
612 )
613 ,"&#xA;"
614 )
615 }
616 else
617 {
618 ()
619 },
620
621 "default return ()","};"
622 )
623 ,"&#xA;"
624 )
625 }
511};626};
512627
628
513(:~629(:~
514 : Returns the XQXQ URL mapper declaration.630 : Returns the XQXQ URL mapper declaration.
515 : @param $case the test case.631 : @param $case the test case.
@@ -556,6 +672,7 @@
556 "&#xA;")672 "&#xA;")
557};673};
558674
675
559(:~676(:~
560 : Checks that a set of dependencies (associated with some test-set or test-case)677 : Checks that a set of dependencies (associated with some test-set or test-case)
561 : are met by Zorba's capabilities and implementation-defined features (as678 : are met by Zorba's capabilities and implementation-defined features (as
562679
=== modified file 'test/fots_driver/evaluate.xq'
--- test/fots_driver/evaluate.xq 2013-02-25 15:39:39 +0000
+++ test/fots_driver/evaluate.xq 2013-02-26 06:33:21 +0000
@@ -27,16 +27,19 @@
2727
28import module namespace xqxq =28import module namespace xqxq =
29 "http://www.zorba-xquery.com/modules/xqxq";29 "http://www.zorba-xquery.com/modules/xqxq";
30
30import module namespace schema =31import module namespace schema =
31 "http://www.zorba-xquery.com/modules/schema";32 "http://www.zorba-xquery.com/modules/schema";
3233
33import module namespace fots-err =34import module namespace fots-err =
34 "http://www.zorba-xquery.com/fots-driver/errors" at "errors.xq";35 "http://www.zorba-xquery.com/fots-driver/errors" at "errors.xq";
36
35import module namespace util =37import module namespace util =
36 "http://www.zorba-xquery.com/fots-driver/util" at "util.xq";38 "http://www.zorba-xquery.com/fots-driver/util" at "util.xq";
3739
38declare namespace err =40declare namespace err =
39 "http://www.w3.org/2005/xqt-errors";41 "http://www.w3.org/2005/xqt-errors";
42
40declare namespace fots =43declare namespace fots =
41 "http://www.w3.org/2010/09/qt-fots-catalog";44 "http://www.w3.org/2010/09/qt-fots-catalog";
4245
@@ -76,6 +79,7 @@
76 </fots:info>79 </fots:info>
77};80};
7881
82
79(:~83(:~
80 : Checks if the error found matches the expected error (if any).84 : Checks if the error found matches the expected error (if any).
81 : @param $result actual result.85 : @param $result actual result.
@@ -119,6 +123,7 @@
119 </fots:info>123 </fots:info>
120};124};
121125
126
122declare %private %ann:sequential function eval:error-code(127declare %private %ann:sequential function eval:error-code(
123 $code as xs:QName?,128 $code as xs:QName?,
124 $errorDescription as xs:string?,129 $errorDescription as xs:string?,
@@ -153,6 +158,7 @@
153 $errorDescription)158 $errorDescription)
154};159};
155160
161
156declare %private %ann:sequential function eval:check-assertion(162declare %private %ann:sequential function eval:check-assertion(
157 $result as item()*,163 $result as item()*,
158 $expResult as element(),164 $expResult as element(),
@@ -162,7 +168,8 @@
162) as xs:string*168) as xs:string*
163{169{
164 let $test := local-name($expResult)170 let $test := local-name($expResult)
165 return switch($test)171 return
172 switch($test)
166 case 'all-of'173 case 'all-of'
167 return eval:assert-all-of($result,174 return eval:assert-all-of($result,
168 $expResult,175 $expResult,
@@ -176,43 +183,44 @@
176 $errorDescription,183 $errorDescription,
177 $testSetBaseURI)184 $testSetBaseURI)
178 case 'assert'185 case 'assert'
179 return eval:assert($result,186 return eval:assert($result, $expResult)
180 $expResult)187
181 case 'assert-count'188 case 'assert-count'
182 return eval:assert-count($result,189 return eval:assert-count($result, $expResult)
183 $expResult)190
184 case 'assert-deep-eq'191 case 'assert-deep-eq'
185 return eval:assert-deep-eq($result,192 return eval:assert-deep-eq($result, $expResult)
186 $expResult)193
187 case 'assert-empty'194 case 'assert-empty'
188 return eval:assert-empty($result)195 return eval:assert-empty($result)
196
189 case 'assert-eq'197 case 'assert-eq'
190 return eval:assert-eq($result,198 return eval:assert-eq($result, $expResult)
191 $expResult)199
192 case 'assert-false'200 case 'assert-false'
193 return eval:assert-false($result)201 return eval:assert-false($result)
202
194 case 'assert-permutation'203 case 'assert-permutation'
195 return eval:assert-permutation($result,204 return eval:assert-permutation($result, $expResult)
196 $expResult)205
197 case 'assert-xml'206 case 'assert-xml'
198 return eval:assert-xml($result,207 return eval:assert-xml($result, $expResult, $testSetBaseURI)
199 $expResult,208
200 $testSetBaseURI)
201 case 'assert-serialization-error'209 case 'assert-serialization-error'
202 return eval:assert-serialization-error($result,210 return eval:assert-serialization-error($result, $expResult, $testSetBaseURI)
203 $expResult,211
204 $testSetBaseURI)
205 case 'assert-string-value'212 case 'assert-string-value'
206 return eval:assert-string-value($result,213 return eval:assert-string-value($result, $expResult)
207 $expResult)214
208 case 'assert-true'215 case 'assert-true'
209 return eval:assert-true($result)216 return eval:assert-true($result)
217
210 case 'assert-type'218 case 'assert-type'
211 return eval:assert-type($result,219 return eval:assert-type($result, $expResult)
212 $expResult)220
213 case 'serialization-matches'221 case 'serialization-matches'
214 return eval:serialization-matches($result,222 return eval:serialization-matches($result, $expResult)
215 $expResult)223
216 case 'error'224 case 'error'
217 return eval:error($result,225 return eval:error($result,
218 $expResult,226 $expResult,
@@ -224,7 +232,10 @@
224 "&#xA;The requested assertion type is not implemented.")232 "&#xA;The requested assertion type is not implemented.")
225};233};
226234
227(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_any-of :)235
236(:
237 : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_any-of
238 :)
228declare %private %ann:sequential function eval:assert-any-of(239declare %private %ann:sequential function eval:assert-any-of(
229 $result as item()*,240 $result as item()*,
230 $expResult as element(),241 $expResult as element(),
@@ -248,7 +259,10 @@
248 string-join(util:serialize-result($results/data(item)), ' '))259 string-join(util:serialize-result($results/data(item)), ' '))
249};260};
250261
251(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_all-of :)262
263(:
264 : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_all-of
265 :)
252declare %private %ann:sequential function eval:assert-all-of(266declare %private %ann:sequential function eval:assert-all-of(
253 $result as item()*,267 $result as item()*,
254 $expResult as element(),268 $expResult as element(),
@@ -265,7 +279,10 @@
265 $baseURI)279 $baseURI)
266};280};
267281
268(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert :)282
283(:
284 : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert
285 :)
269declare %private %ann:sequential function eval:assert(286declare %private %ann:sequential function eval:assert(
270 $result as item()*,287 $result as item()*,
271 $expResult as element()288 $expResult as element()
@@ -295,7 +312,10 @@
295 }312 }
296};313};
297314
298(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-count :)315
316(:
317 : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-count
318 :)
299declare %private function eval:assert-count(319declare %private function eval:assert-count(
300 $result as item()*,320 $result as item()*,
301 $expResult as element()321 $expResult as element()
@@ -306,7 +326,10 @@
306 else "'assert-count' returned: actual number of items is different than the expected number of items."326 else "'assert-count' returned: actual number of items is different than the expected number of items."
307};327};
308328
309(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-deep-eq :)329
330(:
331 : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-deep-eq
332 :)
310declare %private %ann:sequential function eval:assert-deep-eq(333declare %private %ann:sequential function eval:assert-deep-eq(
311 $result as item()*,334 $result as item()*,
312 $expResult as element()335 $expResult as element()
@@ -336,7 +359,10 @@
336 }359 }
337};360};
338361
339(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-empty :)362
363(:
364 : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-empty
365 :)
340declare %private function eval:assert-empty(366declare %private function eval:assert-empty(
341 $result as item()*367 $result as item()*
342) as xs:string?368) as xs:string?
@@ -346,7 +372,10 @@
346 else "'assert-empty' returned: result is not empty as expected."372 else "'assert-empty' returned: result is not empty as expected."
347};373};
348374
349(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-eq :)375
376(:
377 : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-eq
378 :)
350declare %private %ann:sequential function eval:assert-eq(379declare %private %ann:sequential function eval:assert-eq(
351 $result as item()*,380 $result as item()*,
352 $expResult as element()381 $expResult as element()
@@ -385,7 +414,10 @@
385 }414 }
386};415};
387416
388(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-true :)417
418(:
419 : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-true
420 :)
389declare %private function eval:assert-true(421declare %private function eval:assert-true(
390 $result as item()*422 $result as item()*
391) as xs:string?423) as xs:string?
@@ -395,7 +427,10 @@
395 else "'assert-true' returned: query doesn't evaluate to true."427 else "'assert-true' returned: query doesn't evaluate to true."
396};428};
397429
398(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-false :)430
431(:
432 : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-false
433 :)
399declare %private function eval:assert-false(434declare %private function eval:assert-false(
400 $result as item()*435 $result as item()*
401) as xs:string?436) as xs:string?
@@ -405,7 +440,10 @@
405 else "'assert-false' returned: query doesn't evaluate to false."440 else "'assert-false' returned: query doesn't evaluate to false."
406};441};
407442
408(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-permutation :)443
444(:
445 : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-permutation
446 :)
409declare %private %ann:sequential function eval:assert-permutation(447declare %private %ann:sequential function eval:assert-permutation(
410 $result as item()*,448 $result as item()*,
411 $expResult as element()449 $expResult as element()
@@ -434,7 +472,10 @@
434 }472 }
435};473};
436474
437(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-xml :)475
476(:
477 : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-xml
478 :)
438declare %private function eval:assert-xml(479declare %private function eval:assert-xml(
439 $result as item()*,480 $result as item()*,
440 $expResult as element(),481 $expResult as element(),
@@ -458,7 +499,10 @@
458 }499 }
459};500};
460501
461(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-serialization-error :)502
503(:
504 : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-serialization-error
505 :)
462declare %private %ann:sequential function eval:assert-serialization-error(506declare %private %ann:sequential function eval:assert-serialization-error(
463 $result as item()*,507 $result as item()*,
464 $expResult as element(),508 $expResult as element(),
@@ -480,7 +524,10 @@
480 }524 }
481};525};
482526
483(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_serialization-matches :)527
528(:
529 : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_serialization-matches
530 :)
484declare %private function eval:serialization-matches(531declare %private function eval:serialization-matches(
485 $result as item()*,532 $result as item()*,
486 $expResult as element()533 $expResult as element()
@@ -512,7 +559,10 @@
512 }559 }
513};560};
514561
515(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-string-value :)562
563(:
564 : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-string-value
565 :)
516declare %private function eval:assert-string-value(566declare %private function eval:assert-string-value(
517 $result as item()*,567 $result as item()*,
518 $expResult as element()568 $expResult as element()
@@ -536,7 +586,10 @@
536 }586 }
537};587};
538588
539(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-type :)589
590(:
591 : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-type
592 :)
540declare %private %ann:sequential function eval:assert-type(593declare %private %ann:sequential function eval:assert-type(
541 $result as item()*,594 $result as item()*,
542 $expResult as element()595 $expResult as element()
543596
=== modified file 'test/fots_driver/feedback.xq'
--- test/fots_driver/feedback.xq 2013-02-22 11:58:13 +0000
+++ test/fots_driver/feedback.xq 2013-02-26 06:33:21 +0000
@@ -207,8 +207,8 @@
207 variable $info := 'Test case passed but it is marked with EXPECTED_FOTS_FAILURE in test/fots/CMakeLists.txt';207 variable $info := 'Test case passed but it is marked with EXPECTED_FOTS_FAILURE in test/fots/CMakeLists.txt';
208 variable $status := 'fail';208 variable $status := 'fail';
209209
210 (:if ($verbose)210 if ($verbose)
211 then:)211 then
212 {212 {
213 {213 {
214 (insert node attribute result{$status} as last into $case,214 (insert node attribute result{$status} as last into $case,
@@ -231,14 +231,14 @@
231231
232 $case232 $case
233 }233 }
234 } (:234 }
235 else if ($expectedFailure)235 else if ($expectedFailure)
236 then <fots:test-case name="{data($case/@name)}"236 then <fots:test-case name="{data($case/@name)}"
237 result="{$status}"237 result="{$status}"
238 comment="{$info}"/>238 comment="{$info}"/>
239 239
240 else <fots:test-case name="{data($case/@name)}"240 else <fots:test-case name="{data($case/@name)}"
241 result="{$status}"/>:)241 result="{$status}"/>
242};242};
243243
244244
245245
=== modified file 'test/fots_driver/fots-driver.xq'
--- test/fots_driver/fots-driver.xq 2013-02-25 15:39:39 +0000
+++ test/fots_driver/fots-driver.xq 2013-02-26 06:33:21 +0000
@@ -58,7 +58,7 @@
5858
59declare namespace op = "http://www.zorba-xquery.com/options/features";59declare namespace op = "http://www.zorba-xquery.com/options/features";
60declare namespace f = "http://www.zorba-xquery.com/features";60declare namespace f = "http://www.zorba-xquery.com/features";
61declare option op:disable "f:trace";61(:declare option op:disable "f:trace";:)
6262
63(:~63(:~
64 : Returns the names of all qualifying test sets.64 : Returns the names of all qualifying test sets.
@@ -431,10 +431,8 @@
431 }431 }
432};432};
433433
434
434(:~435(:~
435 : This function is just a thin wrapper over the driver:run() function. See
436 : driver:run() for more info.
437 :
438 : Process a specified test set and report the outcome for each containing436 : Process a specified test set and report the outcome for each containing
439 : test case.437 : test case.
440 :438 :
@@ -885,11 +883,13 @@
885883
886884
887(:~885(:~
888 : Creates the complete query that will be evaluated via XQXQ by the fots886 : Creates the text for the complete query FQ that will be evaluated via XQXQ
889 : test driver.887 : by the fots test driver. The actual test-case query TQ will be evaluated as
888 : a nested XQXQ query within FQ. FQ may contain additional nested XQXQ queries,
889 : for example to compute values for external variables declared in TQ.
890 :890 :
891 : @param $queryText the test-case/test after all the additional prolog891 : @param $queryText the text for the test-case query TQ. It is content of
892 : statements were added.892 : <test-case>/test augmented with all the necessary prolog statements.
893 : @param $case the test case.893 : @param $case the test case.
894 : @param $env the environment.894 : @param $env the environment.
895 : @param $envBaseURI URI of the environment.895 : @param $envBaseURI URI of the environment.
@@ -919,15 +919,20 @@
919 (919 (
920 "",920 "",
921 "import module namespace xqxq = 'http://www.zorba-xquery.com/modules/xqxq';",921 "import module namespace xqxq = 'http://www.zorba-xquery.com/modules/xqxq';",
922
922 if (exists($resolver))923 if (exists($resolver))
923 then "declare namespace resolver = 'http://www.zorba-xquery.com/modules/xqxq/url-resolver';"924 then "declare namespace resolver = 'http://www.zorba-xquery.com/modules/xqxq/url-resolver';"
924 else (),925 else (),
926
925 if (exists($mapper))927 if (exists($mapper))
926 then "declare namespace mapper = 'http://www.zorba-xquery.com/modules/xqxq/uri-mapper';"928 then "declare namespace mapper = 'http://www.zorba-xquery.com/modules/xqxq/uri-mapper';"
927 else (),929 else (),
930
928 if (exists($resolver) or exists($mapper)) then $env:hof else (),931 if (exists($resolver) or exists($mapper)) then $env:hof else (),
929 "",932 "",
933
930 if (exists($resolver)) then ($resolver, "") else (),934 if (exists($resolver)) then ($resolver, "") else (),
935
931 if (exists($mapper)) then ($mapper, "") else (),936 if (exists($mapper)) then ($mapper, "") else (),
932937
933 (:938 (:
@@ -951,7 +956,7 @@
951 let $escAposQueryText := replace($queryText,"'","''")956 let $escAposQueryText := replace($queryText,"'","''")
952 let $escAmpQueryText := replace($escAposQueryText, '&amp;', '&amp;amp;')957 let $escAmpQueryText := replace($escAposQueryText, '&amp;', '&amp;amp;')
953 return concat(958 return concat(
954 "variable $queryID := xqxq:prepare-main-module(",959 "variable $queryID := xqxq:prepare-main-module&#xA;(",
955 "&#xA;",960 "&#xA;",
956 "'",961 "'",
957 "&#xA;",962 "&#xA;",
@@ -961,12 +966,11 @@
961 "&#xA;",966 "&#xA;",
962 if (exists($resolver))967 if (exists($resolver))
963 then if(exists($mapper))968 then if(exists($mapper))
964 then ", resolver:url-resolver#2, mapper:uri-mapper#2);"969 then ", resolver:url-resolver#2, mapper:uri-mapper#2&#xA;);"
965 else ", resolver:url-resolver#2, ());"970 else ", resolver:url-resolver#2, ()&#xA;);"
966 else if(exists($mapper))971 else if(exists($mapper))
967 then ", (), mapper:uri-mapper#2);"972 then ", (), mapper:uri-mapper#2&#xA;);"
968 else");973 else "&#xA;);"),
969 "),
970974
971 env:set-context-item($env, $envBaseURI),975 env:set-context-item($env, $envBaseURI),
972 env:set-context-item($case/fots:environment, $testSetBaseURI),976 env:set-context-item($case/fots:environment, $testSetBaseURI),

Subscribers

People subscribed via source and target branches