diff options
Diffstat (limited to 'tests/unit/sxml/sxml-namespaced.scm')
-rw-r--r-- | tests/unit/sxml/sxml-namespaced.scm | 24 |
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 "")) |