Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos_fots 
into lp:zorba.

Commit message:
comments + cosmetic changes in fots_driver/environment.xq

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos_fots/+merge/150278

comments + cosmetic changes in fots_driver/environment.xq
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos_fots/+merge/150278
Your team Zorba Coders is subscribed to branch lp:zorba.
=== 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-25 09:24:22 +0000
@@ -94,6 +94,7 @@
  : Used by the run-test-sets, run-and-report, and report commands.
  :)
 declare variable $exceptedTestCases as xs:string* := (
+  "fn-unparsed-text-lines-052",
   "cbcl-subsequence-011",
   "cbcl-subsequence-012",
   "cbcl-subsequence-013",

=== 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-25 09:24:22 +0000
@@ -24,6 +24,7 @@
 
 import module namespace xqxq =
   "http://www.zorba-xquery.com/modules/xqxq";;
+
 import module namespace util =
   "http://www.zorba-xquery.com/fots-driver/util"; at "util.xq";
 
@@ -69,7 +70,8 @@
 
 
 (:~
- :  Create the text for an XQuery version declaration, if needed.
+ : Create the text for an XQuery version declaration that must be added
+ : to a test-case query.
  :
  : @param $deps the dependencies of the test set and test case.
  : @param $test the raw query text.
@@ -107,7 +109,8 @@
 
 
 (:~
- : Retruns the text for the static-base-uri declarations.
+ : Retruns the text for the static-base-uri declaration that must be added
+ : to a test-case query.
  :
  : NOTE: at least one of $end and $envCase is the empty sequence.
  :
@@ -128,7 +131,8 @@
 
 
 (:~
- : Return the text for the default-element-namespace declaration, if needed.
+ : Create the text for the default-element-namespace declaration that must be
+ : added to a test-case query.
  :
  : NOTE: at least one of $end and $envCase is the empty sequence.
  :
@@ -150,7 +154,8 @@
 
 
 (:~
- : Retruns the text for the necessary namespace declarations.
+ : Create the text for the necessary namespace declarations that must be added
+ : to a test-case query.
  :
  : NOTE: at least one of $end and $envCase is the empty sequence.
  :
@@ -167,15 +172,19 @@
   $test    as xs:string
 ) as xs:string?
 {
-  string-join
-  (
-    for $ns in ($env/fots:namespace, $envCase/fots:namespace)
-    where not($ns[@prefix eq ""]) and
-          not(env:is-schema-prefix-bound($ns/@prefix, $test))
-    return concat('declare namespace ', $ns/@prefix, ' = "', $ns/@uri, '";')
-  ,
-  "
"
-  )
+  if (($env/fots:namespace, $envCase/fots:namespace))
+  then
+    string-join
+    (
+      for $ns in ($env/fots:namespace, $envCase/fots:namespace)
+      where not($ns[@prefix eq ""]) and
+            not(env:is-schema-prefix-bound($ns/@prefix, $test))
+      return concat('declare namespace ', $ns/@prefix, ' = "', $ns/@uri, '";')
+    ,
+    "
"
+    )
+  else
+    ()
 };
 
 
@@ -193,7 +202,8 @@
 
 
 (:~
- : Add the decimal format declarations.
+ : Create the text for the decimal format declarations that must be added
+ : to a test-case query.
  :
  : @param $decimal-formats decimal formats.
  : @return the decimal formats declarations.
@@ -203,7 +213,8 @@
 ) as xs:string*
 {
   if (empty($decimal-formats))
-  then ()
+  then 
+    ()
   else
     for $tmp in $decimal-formats
     let $default := if ($tmp/@name)
@@ -247,8 +258,8 @@
 
 (:~
  : Create the text for all of the variable declarations that must be added to
- : the text of a query. The required declarations are specified by the <param>
- : and <source> subelements of the applicable <environment>.
+ : the text of a test-case query. The required declarations are specified by
+ : the <param> and <source> subelements of the applicable <environment>.
  :
  : NOTE: at least one of $end and $envCase is the empty sequence.
  :
@@ -256,8 +267,10 @@
  :        enviroment specified either at the test-set level or at the catalog
  :        level and is referenced by the test-case.
  : @param $envCase the local environment of the test-case, if any.
- : @param $envBaseURI the relative URI for the environment.
- : @param $testSetBaseURI the URI of the test set.
+ : @param $envBaseURI The absolute pathname of the directory containing the
+ :        file that defines the non-local environment.
+ : @param $testSetBaseURI The absolute pathname of the directory containing the
+ :        test-set file.
  : @return the text for the variable declarations.
  :)
 declare %ann:nondeterministic function env:add-var-decl(
@@ -273,15 +286,15 @@
 };
 
 
-
 declare %private function env:add-var-decls(
   $env         as element(fots:environment)?,
   $envBaseURI  as xs:anyURI
 ) as xs:string?
 {
-  string-join
-  (
-  (
+  let $result :=
+    string-join
+    (
+    (
     for $param in $env/fots:param
     where empty($param[@declared eq "true"])
     return
@@ -328,17 +341,54 @@
     let $role := $source/@role
     where starts-with($role,"$")
     return concat("declare variable ", $role, " external;")
-  )
-  ,
-  " "
-  )
+    )
+    ,
+    " "
+    )
+  return
+    if ($result eq "")
+    then ()
+    else $result
 };
 
 
 (:~
- : Returns the string for setting the context item if needed.
- : @param $env environment.
- : @param $envBaseURI test base URI of the environment.
+ : If a test-case query TQ references a source doc via the context item, this
+ : function creates and returns the xquery code for computing a value for the
+ : context item and binding this value inside TQ. The result of this function
+ : is added to the query FQ that will be evaluated via XQXQ by the fots test
+ : driver. The function assumes that TQ will appear as a nested XQXQ query
+ : within FQ, and that $queryID is the FQ variable storing the XQXQ query id
+ : of TQ.
+ :
+ : If the source doc needs to be validated, the code created by this function
+ : looks like this:
+ :
+ :  variable $contextItemQuery := xqxq:prepare-main-module
+ :  (
+ :  '
+ :  import schema some-prefix = "some-URI";
+ :
+ :  validate { doc("some-xml-file") }
+ :  ',
+ :  (), mapper:uri-mapper#2
+ :  );
+ :
+ : variable $contextItem := xqxq:evaluate($contextItemQuery);
+ :
+ : xqxq:bind-context-item($queryID, $contextItem);
+ :
+ : If no validation is required, the code created by this function looks like
+ : this:
+ :
+ : variable $contextItem := doc("some-xml-file");
+ :
+ : xqxq:bind-context-item($queryID, $contextItem);
+ :
+ : @param $env The environment (local or non-local) that applies to the current
+ :             test case.
+ : @param $envBaseURI The absolute pathname of the directory containing the
+ :        file that defines the environment.
  : @return the string for setting the context item if needed.
  :)
 declare function env:set-context-item(
@@ -347,14 +397,23 @@
 ) as xs:string?
 {
   if (exists($env/fots:source[@role = "."]))
-  then string-join((env:declare-context-item($env, $envBaseURI),
-                   'xqxq:bind-context-item($queryID, $contextItem);')
-                   ,"&#xA;")
-  else ()
+  then 
+    string-join
+    (
+    (
+    env:compute-context-item($env, $envBaseURI),
+    "",
+    'xqxq:bind-context-item($queryID, $contextItem);'
+    )
+    ,
+    "&#xA;"
+    )
+  else
+    ()
 };
 
 
-declare %private function env:declare-context-item(
+declare %private function env:compute-context-item(
   $env        as element(fots:environment)?,
   $envBaseURI as xs:anyURI?
 ) as xs:string
@@ -362,23 +421,68 @@
   let $ciURI := resolve-uri($env/fots:source[@role = "."]/@file, $envBaseURI)
   return
   if (empty($env/fots:source[@validation = "strict"]))
-  then concat('variable $contextItem := doc("', $ciURI, '");')
-  else string-join(
-    ("&#xA;",
-     "variable $contextItemQuery := xqxq:prepare-main-module('",
-     env:get-schema-import($env),
-     concat('validate { doc("', $ciURI, '")', "}',", " "),
-           "(), mapper:uri-mapper#2);",
-           "variable $contextItem := xqxq:evaluate($contextItemQuery);")
-   ,"&#xA;")
+  then
+    concat('variable $contextItem := doc("', $ciURI, '");')
+  else 
+    string-join
+    (
+    (
+    "&#xA;",
+
+    "variable $contextItemQuery := xqxq:prepare-main-module",
+    "(",
+    "'",
+    env:get-schema-import($env),
+    concat('validate { doc("', $ciURI, '")', " }"),
+    "',",
+    "(), mapper:uri-mapper#2",
+    ");",
+    "",
+    "variable $contextItem := xqxq:evaluate($contextItemQuery);"
+    )
+    ,
+    "&#xA;"
+    )
+};
+
+
+declare %private function env:get-schema-import(
+  $env  as element(fots:environment)?
+) as xs:string
+{
+  if (empty($env))
+  then 
+    ""
+  else
+    let $namespace := $env/fots:namespace[@uri eq $env/fots:schema/@uri]
+    let $prefix as xs:string := if (exists($namespace))
+                                then xs:string($namespace/@prefix)
+                                else "p"
+    return
+      if ($prefix eq "")
+      then concat('import schema default element namespace "',
+                  $env/fots:schema/@uri,
+                  '";&#xA;')
+      else concat('import schema namespace ',
+                  $prefix,
+                  ' = "',
+                  $env/fots:schema/@uri,
+                  '";&#xA;')
 };
 
 
 (:~
- : Returns the strings for variable binding in XQXQ.
+ : Creates the xquery code for assigning values to the external variables of
+ : a nested XQXQ query. The nested XQXQ query is a test-case query TQ, and the
+ : result of this function is added to the query FQ that will be evaluated via
+ : XQXQ by the fots test driver. The function assumes that TQ will appear as a
+ : nested XQXQ query within FQ, and that $queryID is the FQ variable storing
+ : the XQXQ query id of TQ.
  :
- : @param $env the environment of the catalog/test-set (given with 'ref').
- : @param $envBaseURI the relative URI for the environment.
+ : @param $env The environment (local or non-local) that applies to the current
+ :        test case 
+ : @param $envBaseURI The absolute pathname of the directory containing the
+ :        file that defines the environment.
  : @return the strings for variable binding in XQXQ.
  :)
 declare function env:set-variables(
@@ -387,73 +491,47 @@
 ) as xs:string?
 {
   if (empty($env))
-  then ()
+  then
+    ()
   else
-    let $srcNames := for $source in $env/fots:source
-                     where starts-with(data($source/@role),"$")
-                     return substring-after(data($source/@role),"$"),
-        $srcValues := for $srcName in $srcNames
-                      return concat('doc("',
-                                  resolve-uri($env/fots:source[@role = concat("$",$srcName)]/@file, $envBaseURI),
-                                  '")')
-  return
-  string-join(
-    (for $srcName in $srcNames
-     let $index := index-of($srcNames, $srcName)
-     return
-      concat('xqxq:bind-variable( $queryID, xs:QName("', $srcName, '")', ', ',
-             $srcValues[$index], ');'),
-
+    string-join
+    (
+    (
+      for $src in $env/fots:source[starts-with(@role, "$")]
+      return
+        concat('xqxq:bind-variable($queryID, xs:QName("',
+               substring-after($src/@role, "$"),
+               '"), ',
+               'doc("',
+               resolve-uri($src/@file, $envBaseURI),
+               '"));')
+      ,
       for $param in $env/fots:param
       let $select:= $param/@select
-      let $file := $env/fots:source[@uri = translate($select, "'", "")]/@file
+      let $file := $env/fots:source[@uri eq translate($select, "'", "")]/@file
       let $varValue := if (starts-with($select, "'") and
-                          ends-with($select, "'") and
-                          exists($file))
-                       then  concat('"',
-                                   resolve-uri($file, $envBaseURI),
-                                   '"')
+                           ends-with($select, "'") and
+                           exists($file))
+                       then  concat('"', resolve-uri($file, $envBaseURI), '"')
                        else $select
       let $varName := $param/@name
-      where (exists($select) and
-(: if there is an attribute 'declared' set to true, this means that the variable
-   is declared within the 'test' itself :)
-             exists($param[@declared="true"]))
+      where (exists($select) and exists($param[@declared eq "true"]))
       return
         concat('xqxq:bind-variable( $queryID, xs:QName("',
                $param/@name,
-               '")', ', ',
-               $varValue, ');'))
-    , "&#xA;")
-};
-
-
-declare %private function env:get-schema-import(
-  $env  as element(fots:environment)?
-) as xs:string
-{
-  if (empty($env))
-  then ""
-  else
-    let $namespace := $env/fots:namespace[@uri = data($env/fots:schema/@uri)]
-    let $prefix as xs:string := if (exists($namespace))
-                                then xs:string(data($namespace/@prefix))
-                                else "p"
-    return
-      if ($prefix = "")
-      then concat('import schema default element namespace "',
-                  $env/fots:schema/@uri,
-                  '";&#xA;')
-      else concat('import schema namespace ',
-                  $prefix,
-                  ' = "',
-                  $env/fots:schema/@uri,
-                  '";&#xA;')
+               '"), ',
+               $varValue,
+               ');') 
+    )
+    ,
+    "&#xA;"
+    )
 };
 
 
 (:~
  : Returns the XQXQ URL resolver declaration.
+ :
  : @param $case the test case.
  : @param $env the environment.
  : @param $envBaseURI URI of the environment.
@@ -471,45 +549,83 @@
   let $resources := $env/fots:resource
   return
     if (empty($modules) and empty($resources))
-    then ()
-    else string-join(
-            ("declare function resolver:url-resolver($namespace as xs:string, $entity as xs:string) {",
-            "switch($entity)",
-    if (exists($modules))
-    then string-join(("case 'module'",
-                      "  return switch($namespace)",
-                      for $module in $modules
-                      return concat("    case '",
-                                   data($module/@uri),
-                                   "' return unparsed-text('",
-                                   resolve-uri($module/@file, $testSetBaseURI),
-                                   "') "),
-                    "    default return ()"),
-                    "&#xA;")
-    else (),
-    if (exists($resources))
     then
-    string-join(("case ''",
-                 "  return switch($namespace)",
-                  for $resource in $resources
-                  return concat("    case '",
-                                 data($resource/@uri),
-                                 "' return unparsed-text('",
-                                 resolve-uri($resource/@file, $envBaseURI),
-                                 "'",
-                                 if (exists($resource/@encoding))
-                                 then concat (",'",
-                                              data($resource/@encoding),
-                                              "'")
-                                 else (),
-                                 ") "),
-                 "         default return ()")
-                ,"&#xA;")
-    else ()
-    , "default return ()","};"),
-    "&#xA;")
+    { 
+      ()
+    }
+    else
+    {
+      string-join
+      (
+      (
+      "declare function resolver:url-resolver($namespace as xs:string, $entity as xs:string)",
+      "{",
+      "switch($entity)",
+
+      if (exists($modules))
+      then
+      {
+        string-join
+        (
+        (
+        "case 'module'",
+        "  return switch($namespace)",
+
+        for $module in $modules
+        return concat("    case '",
+                      data($module/@uri),
+                      "' return unparsed-text('",
+                      resolve-uri($module/@file, $testSetBaseURI),
+                      "') "),
+
+        "    default return ()"
+        )
+        ,"&#xA;"
+        )
+      }
+      else
+      {
+        ()
+      },
+
+      if (exists($resources))
+      then
+      {
+        string-join
+        (
+        (
+        "case ''",
+        "  return switch($namespace)",
+
+        for $resource in $resources
+        return concat("    case '",
+                      data($resource/@uri),
+                      "' return unparsed-text('",
+                      resolve-uri($resource/@file, $envBaseURI),
+                      "'",
+                      if (exists($resource/@encoding))
+                      then concat (",'", data($resource/@encoding), "'")
+                      else (),
+                      ") "),
+
+        "         default return ()"
+        )
+        ,"&#xA;"
+        )
+      }
+      else
+      {
+        ()
+      },
+
+      "default return ()","};"
+      )
+      ,"&#xA;"
+      )
+    }
 };
 
+
 (:~
  : Returns the XQXQ URL mapper declaration.
  : @param $case the test case.
@@ -556,6 +672,7 @@
     "&#xA;")
 };
 
+
 (:~
  : Checks that a set of dependencies (associated with some test-set or test-case)
  : are met by Zorba's capabilities and implementation-defined features (as

=== modified file 'test/fots_driver/evaluate.xq'
--- test/fots_driver/evaluate.xq	2013-02-22 07:31:48 +0000
+++ test/fots_driver/evaluate.xq	2013-02-25 09:24:22 +0000
@@ -27,16 +27,19 @@
 
 import module namespace xqxq =
   "http://www.zorba-xquery.com/modules/xqxq";;
+
 import module namespace schema =
   "http://www.zorba-xquery.com/modules/schema";;
 
 import module namespace fots-err =
   "http://www.zorba-xquery.com/fots-driver/errors"; at "errors.xq";
+
 import module namespace util =
   "http://www.zorba-xquery.com/fots-driver/util"; at "util.xq";
 
 declare namespace err =
   "http://www.w3.org/2005/xqt-errors";;
+
 declare namespace fots =
   "http://www.w3.org/2010/09/qt-fots-catalog";;
 
@@ -72,6 +75,7 @@
     </fots:info>
 };
 
+
 (:~
  : Checks if the error found matches the expected error (if any).
  : @param $result actual result.
@@ -111,6 +115,7 @@
     </fots:info>
 };
 
+
 declare %private %ann:sequential function eval:error-code(
   $code             as xs:QName?,
   $errorDescription as xs:string?,
@@ -143,6 +148,7 @@
               $errorDescription)
 };
 
+
 declare %private %ann:sequential function eval:check-assertion(
   $result           as item()*,
   $expResult        as element(),
@@ -151,7 +157,8 @@
 ) as xs:string*
 {
   let $test := local-name($expResult)
-  return switch($test)
+  return
+    switch($test)
     case 'all-of'
       return eval:assert-all-of($result,
                                 $expResult,
@@ -163,41 +170,44 @@
                                 $code,
                                 $errorDescription)
     case 'assert'
-      return eval:assert($result,
-                         $expResult)
+      return eval:assert($result, $expResult)
+
     case 'assert-count'
-      return eval:assert-count($result,
-                               $expResult)
+      return eval:assert-count($result, $expResult)
+
     case 'assert-deep-eq'
-      return eval:assert-deep-eq($result,
-                                 $expResult)
+      return eval:assert-deep-eq($result, $expResult)
+
     case 'assert-empty'
       return eval:assert-empty($result)
+
     case 'assert-eq'
-      return eval:assert-eq($result,
-                            $expResult)
+      return eval:assert-eq($result, $expResult)
+
     case 'assert-false'
       return eval:assert-false($result)
+
     case 'assert-permutation'
-      return eval:assert-permutation($result,
-                                     $expResult)
+      return eval:assert-permutation($result, $expResult)
+
     case 'assert-xml'
-      return eval:assert-xml($result,
-                             $expResult)
+      return eval:assert-xml($result, $expResult)
+
     case 'assert-serialization-error'
-      return eval:assert-serialization-error($result,
-                                             $expResult)
+      return eval:assert-serialization-error($result, $expResult)
+
     case 'assert-string-value'
-      return eval:assert-string-value($result,
-                                      $expResult)
+      return eval:assert-string-value($result, $expResult)
+
     case 'assert-true'
       return eval:assert-true($result)
+
     case 'assert-type'
-      return eval:assert-type($result,
-                              $expResult)
+      return eval:assert-type($result, $expResult)
+
     case 'serialization-matches'
-      return eval:serialization-matches($result,
-                                        $expResult)
+      return eval:serialization-matches($result, $expResult)
+
     case 'error'
       return eval:error($result,
                         $expResult,
@@ -208,7 +218,10 @@
                    "&#xA;The requested assertion type is not implemented.")
 };
 
-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_any-of :)
+
+(:
+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_any-of
+ :)
 declare %private %ann:sequential function eval:assert-any-of(
   $result           as item()*,
   $expResult        as element(),
@@ -230,7 +243,10 @@
                 string-join(util:serialize-result($results/data(item)), ' '))
 };
 
-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_all-of :)
+
+(:
+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_all-of
+ :)
 declare %private %ann:sequential function eval:assert-all-of(
   $result           as item()*,
   $expResult        as element(),
@@ -245,7 +261,10 @@
                               $errorDescription)
 };
 
-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert :)
+
+(:
+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert
+ :)
 declare %private %ann:sequential function eval:assert(
   $result    as item()*,
   $expResult as element()
@@ -275,7 +294,10 @@
   }
 };
 
-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-count :)
+
+(:
+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-count
+ :)
 declare %private function eval:assert-count(
   $result    as item()*,
   $expResult as element()
@@ -286,7 +308,10 @@
   else "'assert-count' returned: actual number of items is different than the expected number of items."
 };
 
-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-deep-eq :)
+
+(:
+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-deep-eq
+ :)
 declare %private %ann:sequential function eval:assert-deep-eq(
   $result    as item()*,
   $expResult as element()
@@ -316,7 +341,10 @@
   }
 };
 
-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-empty :)
+
+(:
+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-empty
+ :)
 declare %private function eval:assert-empty(
   $result    as item()*
 ) as xs:string?
@@ -326,7 +354,10 @@
   else "'assert-empty' returned: result is not empty as expected."
 };
 
-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-eq :)
+
+(:
+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-eq
+ :)
 declare %private %ann:sequential function eval:assert-eq(
   $result    as item()*,
   $expResult as element()
@@ -365,7 +396,10 @@
   }
 };
 
-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-true :)
+
+(:
+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-true
+ :)
 declare %private function eval:assert-true(
   $result as item()*
 ) as xs:string?
@@ -375,7 +409,10 @@
   else "'assert-true' returned: query doesn't evaluate to true."
 };
 
-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-false :)
+
+(:
+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-false
+ :)
 declare %private function eval:assert-false(
   $result as item()*
 ) as xs:string?
@@ -385,7 +422,10 @@
   else "'assert-false' returned: query doesn't evaluate to false."
 };
 
-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-permutation :)
+
+(:
+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-permutation
+ :)
 declare %private %ann:sequential function eval:assert-permutation(
   $result    as item()*,
   $expResult as element()
@@ -414,7 +454,10 @@
   }
 };
 
-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-xml :)
+
+(:
+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-xml
+ :)
 declare %private function eval:assert-xml(
   $result    as item()*,
   $expResult as element()
@@ -436,7 +479,10 @@
   }
 };
 
-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-serialization-error :)
+
+(:
+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-serialization-error
+ :)
 declare %private %ann:sequential function eval:assert-serialization-error(
   $result    as item()*,
   $expResult as element()
@@ -455,7 +501,10 @@
   }
 };
 
-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_serialization-matches :)
+
+(:
+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_serialization-matches
+ :)
 declare %private function eval:serialization-matches(
   $result    as item()*,
   $expResult as element()
@@ -487,7 +536,10 @@
   }
 };
 
-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-string-value :)
+
+(:
+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-string-value
+ :)
 declare %private function eval:assert-string-value(
   $result    as item()*,
   $expResult as element()
@@ -511,7 +563,10 @@
   }
 };
 
-(: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-type :)
+
+(:
+ : http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-type
+ :)
 declare %private %ann:sequential function eval:assert-type(
   $result    as item()*,
   $expResult as element()

=== modified file 'test/fots_driver/fots-driver.xq'
--- test/fots_driver/fots-driver.xq	2013-02-22 10:41:13 +0000
+++ test/fots_driver/fots-driver.xq	2013-02-25 09:24:22 +0000
@@ -884,11 +884,13 @@
 
 
 (:~
- : Creates the complete query that will be evaluated via XQXQ by the fots
- : test driver.
+ : Creates the text for the complete query FQ that will be evaluated via XQXQ
+ : by the fots test driver. The actual test-case query TQ will be evaluated as
+ : a nested XQXQ query within FQ. FQ may contain additional nested XQXQ queries,
+ : for example to compute values for external variables declared in TQ.
  :
- : @param $queryText the test-case/test after all the additional prolog
- :        statements were added.
+ : @param $queryText the text for the test-case query TQ. It is content of
+ :        <test-case>/test augmented with all the necessary prolog statements.
  : @param $case the test case.
  : @param $env the environment.
  : @param $envBaseURI URI of the environment.
@@ -918,17 +920,23 @@
     (
     "",
     "import module namespace xqxq = 'http://www.zorba-xquery.com/modules/xqxq';",
+
     if (exists($resolver))
     then "declare namespace resolver = 'http://www.zorba-xquery.com/modules/xqxq/url-resolver';"
     else (),
+
     if (exists($mapper))
     then "declare namespace mapper = 'http://www.zorba-xquery.com/modules/xqxq/uri-mapper';"
     else (),
+
     if (exists($resolver) or exists($mapper)) then $env:hof else (),
     "",
+
     if (exists($resolver)) then ($resolver, "") else (),
+
     if (exists($mapper)) then ($mapper, "") else (),
 
+<<<<<<< TREE
     (:
      : We want to put the input query into a new XQuery as a string literal
      : and compile this new XQuery. In order to do so, we must escape some
@@ -951,6 +959,9 @@
     let $escAmpQueryText  := replace($escAposQueryText, '&amp;', '&amp;amp;')
     return concat(
            "variable $queryID := xqxq:prepare-main-module(",
+=======
+    concat("variable $queryID := xqxq:prepare-main-module&#xA;(",
+>>>>>>> MERGE-SOURCE
            "&#xA;",
            "'",
            "&#xA;",
@@ -960,12 +971,17 @@
            "&#xA;",
            if (exists($resolver))
            then if(exists($mapper))
-                then ", resolver:url-resolver#2, mapper:uri-mapper#2);"
-                else ", resolver:url-resolver#2, ());"
+                then ", resolver:url-resolver#2, mapper:uri-mapper#2&#xA;);"
+                else ", resolver:url-resolver#2, ()&#xA;);"
            else if(exists($mapper))
+<<<<<<< TREE
                 then ", (), mapper:uri-mapper#2);"
                 else");
     "),
+=======
+                then ", (), mapper:uri-mapper#2&#xA;);"
+                else"&#xA;);"),
+>>>>>>> MERGE-SOURCE
 
     env:set-context-item($env, $envBaseURI),
     env:set-context-item($case/fots:environment, $testSetBaseURI),

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to