aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/sxml/sxml-namespaced.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-12-13 11:06:57 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2023-12-13 11:17:34 +0100
commit00a66eca0f32fcf585d2c21375641020e877e3ea (patch)
treec2aceeb5047bf46e03726e1c5e8378cf86a4df63 /tests/unit/sxml/sxml-namespaced.scm
parentFix sxml namespaced util. (diff)
downloadcalp-00a66eca0f32fcf585d2c21375641020e877e3ea.tar.gz
calp-00a66eca0f32fcf585d2c21375641020e877e3ea.tar.xz
Update things depending on namespaced sxml.sxml-work
Update all code to emit correctly formed namespaced sxml objects, instead of the old list based approach. Also introduces a number of typechecks which in semi-related parts of the code. Note that the webdav-server test is currently broken.
Diffstat (limited to 'tests/unit/sxml/sxml-namespaced.scm')
-rw-r--r--tests/unit/sxml/sxml-namespaced.scm24
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/unit/sxml/sxml-namespaced.scm b/tests/unit/sxml/sxml-namespaced.scm
index 18e35225..ee1407d6 100644
--- a/tests/unit/sxml/sxml-namespaced.scm
+++ b/tests/unit/sxml/sxml-namespaced.scm
@@ -42,6 +42,18 @@
;;; TODO Attributes
;;; TODO children
+(test-group "Constructing XML documents"
+ (test-assert "With simple content"
+ ((xml 'a) "Hello"))
+
+ (test-assert "Full document"
+ ((xml 'html)
+ ((xml 'head)
+ ((xml #f 'meta '((charset "UTF-8"))))
+ ((xml 'title) "Title text"))
+ ((xml 'body)
+ "This document left blank"))))
+
(test-group "xml->namespaced-sxml"
@@ -73,7 +85,7 @@
root: ((xml 'tag)))
(xml->namespaced-sxml "<?xml encoding=\"utf-8\" version=\"1.0\"?><tag/>"))
- (test-equal "Document with whitespace in it"
+ (test-equal "Document with (untrimmed) whitespace in it"
(xml-document
pi: (list (pi-element 'xml ""))
root: ((xml 'root)
@@ -82,6 +94,16 @@
(xml->namespaced-sxml "<?xml?><root> <a/></root>"
trim-whitespace?: #f))
+ ;; An earlier version trimmed whitespace down inte empty strings,
+ ;; instead of (correctly) omitting the strings completely.
+ (test-equal "Document with (trimmed) whitespace in it"
+ (xml-document
+ pi: (list (pi-element 'xml ""))
+ root: ((xml 'root)
+ ((xml 'a))))
+ (xml->namespaced-sxml "<?xml?><root> <a/></root>"
+ trim-whitespace?: #t))
+
(test-equal "Whitespace before root is discarded kept"
(xml-document
pi: (list (pi-element 'xml ""))