Sorin Marian Nasoi has proposed merging 
lp:~zorba-coders/zorba/fixing_issues_FOTS_driver into lp:zorba.

Commit message:
- implemented support for <assert-xml ignore-prefixes='true'>; as a result 2 
more test cases pass.
- fixed 'qischema016'
- added bug number for test cases 'qischema040' and 'qischema040a'
- added correct validation type for the source documents


Requested reviews:
  Sorin Marian Nasoi (sorin.marian.nasoi)

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

- implemented support for <assert-xml ignore-prefixes='true'>; as a result 2 
more test cases pass.
- fixed 'qischema016'
- added bug number for test cases 'qischema040' and 'qischema040a'
- added correct validation type for the source documents

-- 
https://code.launchpad.net/~zorba-coders/zorba/fixing_issues_FOTS_driver/+merge/155294
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'test/fots/CMakeLists.txt'
--- test/fots/CMakeLists.txt	2013-03-23 15:23:57 +0000
+++ test/fots/CMakeLists.txt	2013-03-25 17:26:22 +0000
@@ -443,7 +443,6 @@
 EXPECTED_FOTS_FAILURE (prod-CastableExpr cbcl-castable-yearMonthDuration-002 0)
 EXPECTED_FOTS_FAILURE (prod-CompAttrConstructor K2-ComputeConAttr-51 0)
 EXPECTED_FOTS_FAILURE (prod-CompAttrConstructor K2-ComputeConAttr-53 0)
-EXPECTED_FOTS_FAILURE (prod-CompAttrConstructor K2-ComputeConAttr-58 0)
 EXPECTED_FOTS_FAILURE (prod-CompDocConstructor K2-ConDocNode-2 0)
 EXPECTED_FOTS_FAILURE (prod-CompNamespaceConstructor nscons-039 0)
 EXPECTED_FOTS_FAILURE (prod-ContextItemDecl contextDecl-016 0)
@@ -564,11 +563,9 @@
 EXPECTED_FOTS_FAILURE (prod-RequireProhibitFeature require-all-optional-features-2-ns2 0)
 EXPECTED_FOTS_FAILURE (prod-RequireProhibitFeature prohibit-all-optional-features-1 0)
 EXPECTED_FOTS_FAILURE (prod-RequireProhibitFeature require-all-optional-features-7-s 0)
-EXPECTED_FOTS_FAILURE (prod-SchemaImport qischema016 0)
 EXPECTED_FOTS_FAILURE (prod-SchemaImport qischema031 0)
-EXPECTED_FOTS_FAILURE (prod-SchemaImport qischema032c 0)
-EXPECTED_FOTS_FAILURE (prod-SchemaImport qischema040 0)
-EXPECTED_FOTS_FAILURE (prod-SchemaImport qischema040a 0)
+EXPECTED_FOTS_FAILURE (prod-SchemaImport qischema040 21339)
+EXPECTED_FOTS_FAILURE (prod-SchemaImport qischema040a 21339)
 EXPECTED_FOTS_FAILURE (prod-SchemaImport substitution-001 0)
 EXPECTED_FOTS_FAILURE (prod-SchemaImport substitution-002 0)
 EXPECTED_FOTS_FAILURE (prod-SchemaImport substitution-003 0)

=== modified file 'test/fots_driver/environment.xq'
--- test/fots_driver/environment.xq	2013-03-21 18:43:40 +0000
+++ test/fots_driver/environment.xq	2013-03-25 17:26:22 +0000
@@ -426,7 +426,7 @@
 {
   let $ciURI := resolve-uri($env/fots:source[@role = "."]/@file, $envBaseURI)
   return
-  if (empty($env/fots:source[@validation = "strict"]))
+  if (empty($env/fots:source/@validation))
   then
   {
     if($needsDTDValidation)
@@ -445,7 +445,7 @@
     "(",
     "'",
     env:get-schema-import($env),
-    concat('validate { doc("', $ciURI, '")', " }"),
+    concat('validate ', xs:string($env/fots:source/@validation),' { doc("', $ciURI, '")', " }"),
     "',",
     "(), mapper:uri-mapper#2",
     ");",
@@ -653,11 +653,23 @@
   $testSetBaseURI as xs:anyURI
 ) as xs:string?
 {
-  let $envSchema := $env/fots:schema,
-      $tcSchema := $case/fots:environment/fots:schema,
-      $schemas := ($envSchema, $tcSchema)
+  let $envSchema := $env/fots:schema
+  let $tcSchema := $case/fots:environment/fots:schema
+  (:
+  Schema documents are identified in the environment in a similar way to source
+  documents. The role attribute indicates whether the schema is imported into
+  the query, or used for source document validation.
+  :)
+  let $schemas := ($envSchema, $tcSchema)
+  let $envSource := for $s in $env/fots:source
+                    where empty($s[@role = "."])
+                    return $s
+  let $tcSource := for $s in $case/fots:environment/fots:source
+                   where empty($s[@role = "."])
+                   return $s
+  let $sources := ($envSource, $tcSource)
   return
-    if (empty($schemas))
+    if (empty($schemas) and empty($sources))
     then ()
     else string-join(
             ("declare function mapper:uri-mapper($namespace as xs:string, $entity as xs:string) {",
@@ -680,6 +692,24 @@
                       "    default return ()")),
                       "&#xA;")
     else (),
+    if (exists($sources))
+    then string-join(("case ''",
+                     "  return switch($namespace)",
+                    (for $source in $envSource
+                     return concat("    case '",
+                                   data($source/@uri),
+                                   "' return '",
+                                   resolve-uri($source/@file, $envBaseURI),
+                                   "'"),
+                      for $source in $tcSource
+                      return concat("    case '",
+                                   data($source/@uri),
+                                   "' return '",
+                                   resolve-uri($source/@file, $testSetBaseURI),
+                                   "'"),
+                      "    default return ()")),
+                      "&#xA;")
+    else (),
     "default return ()","};"),
     "&#xA;")
 };

=== modified file 'test/fots_driver/evaluate.xq'
--- test/fots_driver/evaluate.xq	2013-03-21 18:31:19 +0000
+++ test/fots_driver/evaluate.xq	2013-03-25 17:26:22 +0000
@@ -490,7 +490,11 @@
     let $expectedResult := zorba-xml:canonicalize(concat('<root>', util:get-value($expResult, $baseURI, "assert-xml"), '</root>'))
     
     return
-      if ($actualResult eq $expectedResult)
+      if(empty($expResult[@ignore-prefixes='true']) and
+         ($actualResult eq $expectedResult))
+      then ()
+      else if(exists($expResult[@ignore-prefixes='true']) and
+             fn:parse-xml($actualResult) eq fn:parse-xml($expectedResult)) (: the namespace prefixes are ignored in this comparison :)
       then ()
       else concat("'assert-xml' returned: result &#xA;'", $actualResult, "'&#xA; is different from the expected result &#xA;'", $expectedResult,"'&#xA;")
   } catch * {

-- 
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