-
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1732 from adamretter/1664
Fixes a regression with XQuery Update insert
- Loading branch information
Showing
3 changed files
with
91 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
xquery version "3.1"; | ||
|
||
module namespace xqu="http://exist-db.org/xquery/test/xquery-update"; | ||
|
||
import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; | ||
|
||
|
||
declare | ||
%test:assertEquals('<root><child/></root>') | ||
function xqu:root() { | ||
let $f := xmldb:store('/db', 'xupdate.xml', <root/>) | ||
let $u := update insert <child/> into doc($f)/root | ||
return doc($f) | ||
}; | ||
|
||
declare | ||
%test:assertEquals('<root attr="1"><child/></root>') | ||
function xqu:root_attribute() { | ||
let $r := xmldb:remove('/db', 'xupdate.xml') | ||
let $f := xmldb:store('/db', 'xupdate.xml', <root attr="1"/>) | ||
let $u := update insert <child/> into doc($f)/root | ||
return doc($f) | ||
}; | ||
|
||
declare | ||
%test:assertEquals('<root attr="1"><foo/><child/></root>') | ||
function xqu:root_attribute_child() { | ||
let $r := xmldb:remove('/db', 'xupdate.xml') | ||
let $f := xmldb:store('/db', 'xupdate.xml', <root attr="1"><foo/></root>) | ||
let $u := update insert <child/> into doc($f)/root | ||
return doc($f) | ||
}; | ||
|
||
declare | ||
%test:assertEquals('<root attr="1"><foo bar="2"/><child/></root>') | ||
function xqu:root_attribute_child_attribute() { | ||
let $r := xmldb:remove('/db', 'xupdate.xml') | ||
let $f := xmldb:store('/db', 'xupdate.xml', <root attr="1"><foo bar="2"/></root>) | ||
let $u := update insert <child/> into doc($f)/root | ||
return doc($f) | ||
}; | ||
|
||
declare | ||
%test:assertEquals('<root><!-- foobar --><child/></root>') | ||
function xqu:root_comment() { | ||
let $f := xmldb:store('/db', 'xupdate.xml', <root><!-- foobar --></root>) | ||
let $u := update insert <child/> into doc($f)/root | ||
return doc($f) | ||
}; | ||
|
||
declare | ||
%test:assertEquals('<root attr="1"><!-- foobar --><child/></root>') | ||
function xqu:root_comment_attribute() { | ||
let $f := xmldb:store('/db', 'xupdate.xml', <root attr="1"><!-- foobar --></root>) | ||
let $u := update insert <child/> into doc($f)/root | ||
return doc($f) | ||
}; |