From 65ad971c9614b2bc49583b61d2b35942d91150fd Mon Sep 17 00:00:00 2001 From: Juri Leino Date: Mon, 20 Mar 2023 11:32:56 +0100 Subject: [PATCH] [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. --- .../src/test/xquery/xquery3/serialize.xql | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/exist-core/src/test/xquery/xquery3/serialize.xql b/exist-core/src/test/xquery/xquery3/serialize.xql index 21cf89c42b0..dae99b2939e 100644 --- a/exist-core/src/test/xquery/xquery3/serialize.xql +++ b/exist-core/src/test/xquery/xquery3/serialize.xql @@ -671,6 +671,13 @@ function ser:exist-output-doctype-true() { map { "exist:output-doctype": true() }) }; +declare + %test:assertXPath("contains($result, '-//OASIS//DTD DITA BookMap//EN') and contains($result, 'bookmap.dtd')") +function ser:exist-output-doctype-true-QName() { + serialize(doc($ser:collection || "/test-with-doctype.xml"), + map { xs:QName("exist:output-doctype"): true() }) +}; + declare %test:assertXPath("not(contains($result, '-//OASIS//DTD DITA BookMap//EN')) and not(contains($result, 'bookmap.dtd'))") function ser:exist-output-doctype-false() { @@ -692,6 +699,13 @@ function ser:exist-expand-xinclude-true() { map { "exist:expand-xincludes": true() }) }; +declare + %test:assertXPath("contains($result, 'comment')") +function ser:exist-expand-xinclude-true-QName() { + serialize($ser:xi-doc, + map { xs:QName("exist:expand-xincludes"): true() }) +}; + declare %test:assertEquals('123') function ser:exist-add-exist-id-all() { @@ -699,6 +713,13 @@ function ser:exist-add-exist-id-all() { map { "exist:add-exist-id": "all" }) }; +declare + %test:assertEquals('123') +function ser:exist-add-exist-id-all-QName() { + serialize(doc($ser:collection || "/test.xml"), + map { xs:QName("exist:add-exist-id"): "all" }) +}; + declare %test:assertEquals('123') function ser:exist-add-exist-id-element() { @@ -729,6 +750,22 @@ function ser:exist-jsonp() { ) }; +declare + %test:assertEquals('functionName({"author":["John Doe","Robert Smith"]})') +function ser:exist-jsonp-QName() { + serialize( + + John Doe + Robert Smith + , + map { + "method": "json", + "media-type": "application/json", + xs:QName("exist:jsonp"): "functionName" + } + ) +}; + declare %test:assertEquals('processed') function ser:exist-process-xsl-pi-true() { @@ -736,6 +773,13 @@ function ser:exist-process-xsl-pi-true() { map { "exist:process-xsl-pi": true() }) }; +declare + %test:assertEquals('processed') +function ser:exist-process-xsl-pi-true-QName() { + serialize(doc($ser:collection || "/test-xsl.xml"), + map { xs:QName("exist:process-xsl-pi"): true() }) +}; + declare %test:assertXPath("contains($result, 'stylesheet')") function ser:exist-process-xsl-pi-false() {