<< TrueForge OUTBOUND_URL_ALLOWED_HOSTS | Home

Running XQSuite Tests as a Main Module

xquery version "3.1";
import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql";

declare namespace inspect = "http://exist-db.org/xquery/inspection";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:indent "yes";

declare variable $local:XML := document {
    <doc><div n="outer"><head>x</head><div n="inner"><head>x</head><p>y</p></div></div></doc>
};
declare variable $local:COLL := "/db/test-nested-predicate";

declare %test:setUp function local:setup() {
    xmldb:create-collection("/db", "test-nested-predicate"),
    xmldb:store($local:COLL, "test.xml", $local:XML)
};
declare %test:tearDown function local:tearDown() {
    if (xmldb:collection-available($local:COLL)) then xmldb:remove($local:COLL) else ()
};
declare %test:assertEquals("outer", "inner") function local:in-memory() {
    $local:XML//div[.//p[. = "y"]] ! string(@n)
};
declare %test:assertEquals("outer", "inner") function local:stored() {
    doc($local:COLL || "/test.xml")//div[.//p[. = "y"]] ! string(@n)
};

test:suite(inspect:module-functions())
Tags : ,
Social Bookmarks :  Add this post to Slashdot    Add this post to Digg    Add this post to Reddit    Add this post to Delicious    Add this post to Stumble it    Add this post to Google    Add this post to Technorati    Add this post to Bloglines    Add this post to Facebook    Add this post to Furl    Add this post to Windows Live    Add this post to Yahoo!

Export this post as PDF document  Export this post to PDF document




Add a comment Send a TrackBack