|
| 1 | +(: |
| 2 | + : Elemental |
| 3 | + : Copyright (C) 2024, Evolved Binary Ltd |
| 4 | + : |
| 5 | + : admin@evolvedbinary.com |
| 6 | + : https://www.evolvedbinary.com | https://www.elemental.xyz |
| 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; version 2.1. |
| 11 | + : |
| 12 | + : This library is distributed in the hope that it will be useful, |
| 13 | + : but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | + : Lesser General Public License for more details. |
| 16 | + : |
| 17 | + : You should have received a copy of the GNU Lesser General Public |
| 18 | + : License along with this library; if not, write to the Free Software |
| 19 | + : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | + :) |
| 21 | +xquery version "3.0"; |
| 22 | + |
| 23 | +(:~ |
| 24 | + : Tests for Processing Instruction nodes. |
| 25 | + : |
| 26 | + : @author Adam Retter |
| 27 | + :) |
| 28 | +module namespace pi = "http://exist-db.org/xquery/test/pi"; |
| 29 | + |
| 30 | +import module namespace test = "http://exist-db.org/xquery/xqsuite"; |
| 31 | + |
| 32 | +declare %private variable $pi:doc1 := document { |
| 33 | + <?my-pi my-pi-content ?>, |
| 34 | + <x/> |
| 35 | +}; |
| 36 | + |
| 37 | +declare |
| 38 | + %test:setUp |
| 39 | +function pi:setup() { |
| 40 | + let $test-collection := xmldb:create-collection("/db", "pi-test") |
| 41 | + return |
| 42 | + xmldb:store($test-collection, "doc1.xml", $pi:doc1) |
| 43 | +}; |
| 44 | + |
| 45 | +declare |
| 46 | + %test:tearDown |
| 47 | +function pi:tearDown() { |
| 48 | + xmldb:remove("/db/pi-test") |
| 49 | +}; |
| 50 | + |
| 51 | +declare |
| 52 | + %test:assertEquals("my-pi") |
| 53 | +function pi:in-memory-dom-pi-name() { |
| 54 | + $pi:doc1/processing-instruction()/name() |
| 55 | +}; |
| 56 | + |
| 57 | +declare |
| 58 | + %test:assertEquals("my-pi") |
| 59 | +function pi:persistent-dom-pi-name() { |
| 60 | + doc("/db/pi-test/doc1.xml")/processing-instruction()/name() |
| 61 | +}; |
0 commit comments