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