Sorin Marian Nasoi has proposed merging lp:~zorba-coders/zorba/fix_assert_xml into lp:zorba.
Commit message: Fix FOTS driver bug that caused <assert-xml file="SOME_URI"/> to be interpreted as <assert-xml/>. Requested reviews: Sorin Marian Nasoi (sorin.marian.nasoi) For more details, see: https://code.launchpad.net/~zorba-coders/zorba/fix_assert_xml/+merge/150353 Fix FOTS driver bug that caused <assert-xml file="SOME_URI"/> to be interpreted as <assert-xml/>. -- https://code.launchpad.net/~zorba-coders/zorba/fix_assert_xml/+merge/150353 Your team Zorba Coders is subscribed to branch lp:zorba.
=== 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 15:49:24 +0000 @@ -51,17 +51,21 @@ : Checks if the result matches the assertions. : @param $result actual result. : @param $expResult expected result. + : @param $testSetBaseURI the URI of the directory that contains the file of the + associated test set. : @return the results of assertion evaluations. :) declare %ann:sequential function eval:result( - $result as item()*, - $expResult as element() + $result as item()*, + $expResult as element(), + $testSetBaseURI as xs:anyURI ) as element()* { let $err := eval:check-assertion($result, $expResult, (), - "") + "", + $testSetBaseURI) return if (empty($err)) then () else @@ -78,20 +82,24 @@ : @param $expResult expected result. : @param $code err:code. : @param $errorDescription err:description. + : @param $testSetBaseURI the URI of the directory that contains the file of the + associated test set. : @return the results of error evaluation. :) declare %ann:sequential function eval:error( $result as item()*, $expResult as element(), $code as xs:QName?, - $errorDescription as xs:string? + $errorDescription as xs:string?, + $testSetBaseURI as xs:anyURI ) as element()* { if (empty($result)) then let $err := eval:error-code($code, $errorDescription, - $expResult) + $expResult, + $testSetBaseURI) return if (empty($err)) then () @@ -114,7 +122,8 @@ declare %private %ann:sequential function eval:error-code( $code as xs:QName?, $errorDescription as xs:string?, - $expResult as element() + $expResult as element(), + $testSetBaseURI as xs:anyURI ) as xs:string* { let $assertName := local-name($expResult) @@ -136,7 +145,8 @@ then eval:check-assertion((), $expResult, $code, - $errorDescription) + $errorDescription, + $testSetBaseURI) else concat("Expected result, found error ", local-name-from-QName($code), " - ", @@ -147,7 +157,8 @@ $result as item()*, $expResult as element(), $code as xs:QName?, - $errorDescription as xs:string? + $errorDescription as xs:string?, + $testSetBaseURI as xs:anyURI ) as xs:string* { let $test := local-name($expResult) @@ -156,12 +167,14 @@ return eval:assert-all-of($result, $expResult, $code, - $errorDescription) + $errorDescription, + $testSetBaseURI) case 'any-of' return eval:assert-any-of($result, $expResult, $code, - $errorDescription) + $errorDescription, + $testSetBaseURI) case 'assert' return eval:assert($result, $expResult) @@ -183,10 +196,12 @@ $expResult) case 'assert-xml' return eval:assert-xml($result, - $expResult) + $expResult, + $testSetBaseURI) case 'assert-serialization-error' return eval:assert-serialization-error($result, - $expResult) + $expResult, + $testSetBaseURI) case 'assert-string-value' return eval:assert-string-value($result, $expResult) @@ -202,7 +217,8 @@ return eval:error($result, $expResult, $code, - $errorDescription) + $errorDescription, + $testSetBaseURI) default return error($fots-err:errNA, "
The requested assertion type is not implemented.") @@ -213,7 +229,8 @@ $result as item()*, $expResult as element(), $code as xs:QName?, - $errorDescription as xs:string? + $errorDescription as xs:string?, + $baseURI as xs:anyURI ) as xs:string? { let $results := @@ -222,7 +239,8 @@ for $r in eval:check-assertion($result, $tmp, $code, - $errorDescription) + $errorDescription, + $baseURI) return <item>{$r}</item> } </result> where every $result in $results satisfies $result/item @@ -235,14 +253,16 @@ $result as item()*, $expResult as element(), $code as xs:QName?, - $errorDescription as xs:string? + $errorDescription as xs:string?, + $baseURI as xs:anyURI ) as xs:string* { for $tmp in $expResult/* return eval:check-assertion($result, $tmp, $code, - $errorDescription) + $errorDescription, + $baseURI) }; (: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert :) @@ -417,17 +437,19 @@ (: 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() + $expResult as element(), + $baseURI as xs:anyURI ) { (:TODO call xml-canonicalization after bug #1076919 is implemented.:) try { let $serRes := util:serialize-result($result), $result1 as xs:string := string-join($serRes,''), - $result2 as xs:string := string-join($serRes,' ') + $result2 as xs:string := string-join($serRes,' '), + $expectedResult as xs:string := util:get-value($expResult, $baseURI, "assert-xml") return - if ((normalize-space($result1) eq normalize-space(string($expResult))) or - (normalize-space($result2) eq normalize-space(string($expResult)))) + if ((normalize-space($result1) eq normalize-space(string($expectedResult))) or + (normalize-space($result2) eq normalize-space(string($expectedResult)))) then () else "'assert-xml' returned: result is different from the expected result." } catch * { @@ -439,7 +461,9 @@ (: 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() + $expResult as element(), + $baseURI as xs:anyURI + ) as xs:string? { try { @@ -451,7 +475,8 @@ eval:error((), $expResult, $err:code, - $err:description) + $err:description, + $baseURI) } }; === 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 15:49:24 +0000 @@ -872,7 +872,8 @@ eval:error((), $case/fots:result/*, $err:code, - $err:description), + $err:description, + $testSetBaseURI), "fots-driver.xq:driver:test catch", $testSetName, $env, @@ -1005,12 +1006,9 @@ variable $queryResult := xqxq:evaluate-sequential($queryKey); - (:TODO check if this works:) - (:variable $expResult := util:get-value($case, $testSetBaseURI, "result");:) - xqxq:delete-query($queryKey); - eval:result($queryResult, $case/fots:result/*) + eval:result($queryResult, $case/fots:result/*, $testSetBaseURI) } } catch * @@ -1018,6 +1016,7 @@ eval:error((), $case/fots:result/*, $err:code, - $err:description) + $err:description, + $testSetBaseURI) } }; === added file 'test/fots_driver/tools/list_node_names_with_file_attribute.xq' --- test/fots_driver/tools/list_node_names_with_file_attribute.xq 1970-01-01 00:00:00 +0000 +++ test/fots_driver/tools/list_node_names_with_file_attribute.xq 2013-02-25 15:49:24 +0000 @@ -0,0 +1,45 @@ +(: + : Copyright 2006-2011 The FLWOR Foundation. + : + : Licensed under the Apache License, Version 2.0 (the "License"); + : you may not use this file except in compliance with the License. + : You may obtain a copy of the License at + : + : http://www.apache.org/licenses/LICENSE-2.0 + : + : Unless required by applicable law or agreed to in writing, software + : distributed under the License is distributed on an "AS IS" BASIS, + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + : See the License for the specific language governing permissions and + : limitations under the License. + :) + +(:~ + : list all node-names of the nodes that contain a child with a 'file' attribute. + : At the moment this is the list: "source", "schema", "assert-xml", "module", "test" + : + : @author Sorin Nasoi + :) + +import module namespace util = + "http://www.zorba-xquery.com/fots-driver/util" at "../util.xq"; + +declare namespace fots = + "http://www.w3.org/2010/09/qt-fots-catalog"; + +let $fotsPath := "../../../build/test/fots/2011/QT3-test-suite/catalog.xml" +let $doc := doc(resolve-uri($fotsPath)) +let $baseUri:= resolve-uri(util:parent-folder($fotsPath)) +return +distinct-values( + for $testSet in $doc/fots:catalog/fots:test-set + let $testSetDoc := doc(resolve-uri($testSet/@file, $baseUri)) + let $testSetName := xs:string($testSet/@name) + return + distinct-values(for $case in $testSetDoc//fots:test-case + return distinct-values(for $node in $case/descendant-or-self::* + where exists($node/@file) + return local-name-from-QName(node-name($node)) + ) + ) +) === modified file 'test/fots_driver/tools/process.xq' --- test/fots_driver/tools/process.xq 2012-12-18 14:13:20 +0000 +++ test/fots_driver/tools/process.xq 2013-02-25 15:49:24 +0000 @@ -36,7 +36,8 @@ declare namespace fots = "http://www.w3.org/2010/09/qt-fots-catalog"; -declare variable $fotsPath as xs:string external := ""; +declare variable $fotsPath as xs:string external := + "../../../build/test/fots/2011/QT3-test-suite/catalog.xml"; declare variable $dependency as xs:string external := ""; declare variable $testSetPrefixes as xs:string external := ""; === modified file 'test/fots_driver/util.xq' --- test/fots_driver/util.xq 2013-02-19 14:06:08 +0000 +++ test/fots_driver/util.xq 2013-02-25 15:49:24 +0000 @@ -71,24 +71,24 @@ : or : (b) the typed value of the node (assuming it is promotable to string). : - : @param $case test-case element. + : @param $parentNode + : @param $baseURI : @param $node-name - : @param $envBaseURI - : @return the query text. + : @return the content of the node with name 'node-name'. :) declare %ann:nondeterministic function util:get-value( - $case as element(fots:test-case), - $envBaseURI as xs:anyURI, + $parentNode as element(), + $baseURI as xs:anyURI, $node-name as xs:string ) as xs:string { try { - for $node in $case/descendant-or-self::* + for $node in $parentNode/descendant-or-self::* where (fn:local-name-from-QName(fn:node-name($node)) eq $node-name) return if ($node/@file) - then fn:unparsed-text(resolve-uri($node/@file, $envBaseURI)) + then fn:unparsed-text(resolve-uri($node/@file, $baseURI)) else fn:string($node) } 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