Merge branch 'xmlgen-bug-fixes'
[ShellArchive.git] / xmlgen.etest
blobeb68fddfdd51fa51be39c9d783ed3b483f9c5f3d
1 (etest
2  ("xml-gen"
3   ("extract-plist"
4    (equal (xmlgen-extract-plist '(h1 :class "big" "A Title"))
5           '((h1 "A Title") (:class "big")))
6    (equal (xmlgen-extract-plist '(hello :big "world"))
7           '((hello) (:big "world")))
8    (equal (xmlgen-extract-plist '(big :one 1 :two 2 :three 3))
9           '((big) (:one 1 :two 2 :three 3))
10           "Slightly bigger plist")
11    (error (xmlgen-extract-plist '(hello "world" :how))
12           "Error thrown when plist is wrong size"))
13   ("xmlgen-attr-to-string"
14    (equal (xmlgen-attr-to-string '(:one "1" :two "2")) " one=\"1\" two=\"2\""))
15   ("xmlgen-string-escape"
16    (equal "This & this" (xmlgen-string-escape "This & this"))
17    (equal "This &lt;&amp;&gt; this" (xmlgen-string-escape "This <&> this")))
18   ("xmlgen"
19    (equal (xmlgen '(p "this & this")) "<p>this &amp; this</p>")
20    (equal (xmlgen '(p :class "big")) "<p class=\"big\"/>")
21    (equal (xmlgen '(p :class "big" "hi")) "<p class=\"big\">hi</p>")
22    (equal (xmlgen '(h1)) "<h1/>")
23    (equal (xmlgen '(h1 "Title")) "<h1>Title</h1>")
24    (equal (xmlgen '(h1 :class "something" "hi"))
25         "<h1 class=\"something\">hi</h1>")
26    (equal (xmlgen '(p "hello" "again")) "<p>helloagain</p>")
27    ("more complex"
28     (equal (xmlgen
29             '(html
30               (head
31                (title "hello")
32                (meta :something "hi"))))
33             (concat "<html><head><title>hello</title><meta something=\"hi\"/></head></html>"))))))