From 00a66eca0f32fcf585d2c21375641020e877e3ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 13 Dec 2023 11:06:57 +0100 Subject: Update things depending on namespaced sxml. 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. --- tests/unit/sxml/sxml-namespaced.scm | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'tests/unit/sxml/sxml-namespaced.scm') 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 "")) - (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 " " 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 " " + trim-whitespace?: #t)) + (test-equal "Whitespace before root is discarded kept" (xml-document pi: (list (pi-element 'xml "")) -- cgit v1.2.3