-
-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Add xquery recursive collection creation with just one path expression #5062
base: develop
Are you sure you want to change the base?
Changes from all commits
7ee7a8d
206772a
66a060e
f907b10
5135da7
78bf82e
e898899
31abe51
ff155b8
e7118ed
ac5f200
7cbd6dd
43f331f
cf1a8de
1915cfa
3ed9193
213d9bd
11b270b
138b435
fa16fd4
61faaae
72bc0ee
bd4d1d2
b963c00
4f71bdc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
(: | ||
: eXist-db Open Source Native XML Database | ||
: Copyright (C) 2001 The eXist-db Authors | ||
: | ||
: [email protected] | ||
: http://www.exist-db.org | ||
: | ||
: This library is free software; you can redistribute it and/or | ||
: modify it under the terms of the GNU Lesser General Public | ||
: License as published by the Free Software Foundation; either | ||
: version 2.1 of the License, or (at your option) any later version. | ||
: | ||
: This library is distributed in the hope that it will be useful, | ||
: but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
: Lesser General Public License for more details. | ||
: | ||
: You should have received a copy of the GNU Lesser General Public | ||
: License along with this library; if not, write to the Free Software | ||
: Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
:) | ||
xquery version "3.0"; | ||
|
||
module namespace t="http://exist-db.org/testsuite/collection-create"; | ||
|
||
import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; | ||
|
||
declare variable $t:parent-collection-name := "/parent-collection"; | ||
declare variable $t:parent-collection := "/db" || $t:parent-collection-name; | ||
declare variable $t:path-collection := $t:parent-collection || "/path/to/new-collection"; | ||
declare variable $t:path-collection-from-root := "/db/path/to/new-collection-from-root"; | ||
declare variable $t:wrong-path-collection := "/wrong/path-to-collection"; | ||
|
||
declare | ||
%test:setUp | ||
function t:setup() { | ||
xmldb:create-collection("/db", $t:parent-collection-name) | ||
}; | ||
|
||
declare | ||
%test:tearDown | ||
function t:cleanup() { | ||
xmldb:remove($t:parent-collection), | ||
xmldb:remove($t:path-collection-from-root) | ||
}; | ||
|
||
declare | ||
%test:assertEquals("/db/parent-collection/path/to/new-collection") | ||
function t:fn-create-new-recursive-collection() { | ||
let $collection := xmldb:create-collection($t:path-collection) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do I understand correctly that you are currently testing that:
creates the collection If so, that should not work! The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks good to me |
||
return $collection | ||
}; | ||
|
||
declare | ||
%test:assertEquals("/db/path/to/new-collection-from-root") | ||
function t:fn-create-new-recursive-collection-from-root() { | ||
let $collection := xmldb:create-collection($t:path-collection-from-root) | ||
return $collection | ||
}; | ||
|
||
declare | ||
%test:assertError | ||
function t:fn-create-new-recursive-collection-with-wrong-path() { | ||
xmldb:create-collection($t:wrong-path-collection) | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shoudl this go in to
try(final Collection newCollection..)
?