Skip to content

Commit 72f4c94

Browse files
committed
[test] add tests with QName options
eXist-db specific extensions to serialization options can also be set using the QName instead of plain strings. Add one test per option using the non-default value.
1 parent ab9afef commit 72f4c94

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

exist-core/src/test/xquery/xquery3/serialize.xql

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,13 @@ function ser:exist-output-doctype-true() {
671671
map { "exist:output-doctype": true() })
672672
};
673673

674+
declare
675+
%test:assertXPath("contains($result, '-//OASIS//DTD DITA BookMap//EN') and contains($result, 'bookmap.dtd')")
676+
function ser:exist-output-doctype-true-QName() {
677+
serialize(doc($ser:collection || "/test-with-doctype.xml"),
678+
map { xs:QName("exist:output-doctype"): true() })
679+
};
680+
674681
declare
675682
%test:assertXPath("not(contains($result, '-//OASIS//DTD DITA BookMap//EN')) and not(contains($result, 'bookmap.dtd'))")
676683
function ser:exist-output-doctype-false() {
@@ -692,13 +699,27 @@ function ser:exist-expand-xinclude-true() {
692699
map { "exist:expand-xincludes": true() })
693700
};
694701

702+
declare
703+
%test:assertXPath("contains($result, 'comment')")
704+
function ser:exist-expand-xinclude-true-QName() {
705+
serialize($ser:xi-doc,
706+
map { xs:QName("exist:expand-xincludes"): true() })
707+
};
708+
695709
declare
696710
%test:assertEquals('<?pi?><elem xmlns:exist="http://exist.sourceforge.net/NS/exist" exist:id="2" exist:source="test.xml" a="abc"><!--comment--><b exist:id="2.3">123</b></elem>')
697711
function ser:exist-add-exist-id-all() {
698712
serialize(doc($ser:collection || "/test.xml"),
699713
map { "exist:add-exist-id": "all" })
700714
};
701715

716+
declare
717+
%test:assertEquals('<?pi?><elem xmlns:exist="http://exist.sourceforge.net/NS/exist" exist:id="2" exist:source="test.xml" a="abc"><!--comment--><b exist:id="2.3">123</b></elem>')
718+
function ser:exist-add-exist-id-all-QName() {
719+
serialize(doc($ser:collection || "/test.xml"),
720+
map { xs:QName("exist:add-exist-id"): "all" })
721+
};
722+
702723
declare
703724
%test:assertEquals('<?pi?><elem xmlns:exist="http://exist.sourceforge.net/NS/exist" exist:id="2" exist:source="test.xml" a="abc"><!--comment--><b>123</b></elem>')
704725
function ser:exist-add-exist-id-element() {
@@ -729,13 +750,36 @@ function ser:exist-jsonp() {
729750
)
730751
};
731752

753+
declare
754+
%test:assertEquals('functionName({"author":["John Doe","Robert Smith"]})')
755+
function ser:exist-jsonp-QName() {
756+
serialize(
757+
<book>
758+
<author>John Doe</author>
759+
<author>Robert Smith</author>
760+
</book>,
761+
map {
762+
"method": "json",
763+
"media-type": "application/json",
764+
xs:QName("exist:jsonp"): "functionName"
765+
}
766+
)
767+
};
768+
732769
declare
733770
%test:assertEquals('processed')
734771
function ser:exist-process-xsl-pi-true() {
735772
serialize(doc($ser:collection || "/test-xsl.xml"),
736773
map { "exist:process-xsl-pi": true() })
737774
};
738775

776+
declare
777+
%test:assertEquals('processed')
778+
function ser:exist-process-xsl-pi-true-QName() {
779+
serialize(doc($ser:collection || "/test-xsl.xml"),
780+
map { xs:QName("exist:process-xsl-pi"): true() })
781+
};
782+
739783
declare
740784
%test:assertXPath("contains($result, 'stylesheet')")
741785
function ser:exist-process-xsl-pi-false() {

0 commit comments

Comments
 (0)