Skip to content

Commit e906b1e

Browse files
committed
[test] Add tests for XQuery Update namespace binding conflict
1 parent 0c6f19a commit e906b1e

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* eXist-db Open Source Native XML Database
3+
* Copyright (C) 2001 The eXist-db Authors
4+
*
5+
6+
* http://www.exist-db.org
7+
*
8+
* This library is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Lesser General Public
10+
* License as published by the Free Software Foundation; either
11+
* version 2.1 of the License, or (at your option) any later version.
12+
*
13+
* This library is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16+
* Lesser General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU Lesser General Public
19+
* License along with this library; if not, write to the Free Software
20+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21+
*/
22+
package xquery.update;
23+
24+
import org.exist.test.runner.XSuite;
25+
import org.junit.runner.RunWith;
26+
27+
@RunWith(XSuite.class)
28+
@XSuite.XSuiteFiles({
29+
"src/test/xquery/update"
30+
})
31+
public class UpdateTests {
32+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
(:
2+
: eXist-db Open Source Native XML Database
3+
: Copyright (C) 2001 The eXist-db Authors
4+
:
5+
6+
: http://www.exist-db.org
7+
:
8+
: This library is free software; you can redistribute it and/or
9+
: modify it under the terms of the GNU Lesser General Public
10+
: License as published by the Free Software Foundation; either
11+
: version 2.1 of the License, or (at your option) any later version.
12+
:
13+
: This library is distributed in the hope that it will be useful,
14+
: but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16+
: Lesser General Public License for more details.
17+
:
18+
: You should have received a copy of the GNU Lesser General Public
19+
: License along with this library; if not, write to the Free Software
20+
: Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21+
:)
22+
xquery version "3.1";
23+
24+
module namespace unbt = "http://exist-db.org/xquery/update/namespace-binding-test";
25+
26+
import module namespace xmldb = "http://exist-db.org/xquery/xmldb";
27+
28+
declare namespace test = "http://exist-db.org/xquery/xqsuite";
29+
declare namespace myns = "http://www.foo.com";
30+
31+
declare %private variable $unbt:test := document {
32+
<x xmlns:myns="http://www.bar.com">
33+
<z/>
34+
</x>
35+
};
36+
37+
declare
38+
%test:setup
39+
function unbt:setup() {
40+
let $xml := fn:parse-xml('<x xmlns:myns="http://www.bar.com"><z/></x>')
41+
return
42+
xmldb:store("/db", "namespace-binding-test-1.xml", $xml)
43+
,
44+
xmldb:store("/db", "namespace-binding-test-2.xml", $unbt:test)
45+
};
46+
47+
declare
48+
%test:teardown
49+
function unbt:teardown() {
50+
xmldb:remove("/db/namespace-binding-test-1.xml"),
51+
xmldb:remove("/db/namespace-binding-test-2.xml"),
52+
};
53+
54+
declare
55+
%test:assertError("XUDY0023")
56+
function unbt:insert-namespaced-attribute-1() {
57+
update insert attribute myns:baz { "qux" } into doc("/db/namespace-binding-test-1.xml")/x/z
58+
};
59+
60+
declare
61+
%test:assertError("XUDY0023")
62+
function unbt:insert-namespaced-attribute-2() {
63+
update insert attribute myns:baz { "qux" } into doc("/db/namespace-binding-test-2.xml")/x/z
64+
};

0 commit comments

Comments
 (0)