-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.scm
38 lines (29 loc) · 1.01 KB
/
test.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
(import (scheme base)
(cyclone test)
(cyclone sxml))
(define (run-tests)
(test-begin "SXML")
(test "sxml->xml"
"<html><head>Test</head><body><h1 name=\"t\">Test</h1></body></html>"
(sxml->xml '(html (head "Test") (body (h1 (@ (name "t")) "Test")))))
(test "sxml-display-as-html"
"<html><head>Test</head><body><h1>Test</h1></body></html>"
(parameterize ((current-output-port (open-output-string)))
(sxml-display-as-html '(html (head "Test") (body (h1 "Test"))))
(get-output-string (current-output-port))))
(test "sxml-display-as-text"
"Test\n"
(parameterize ((current-output-port (open-output-string)))
(sxml-display-as-text '(html (head "Test") (body (h1 "Test"))))
(get-output-string (current-output-port))))
(test "sxml-strip"
"TestTest"
(sxml-strip '(html (head "Test") (body (h1 "Test")))))
(test "html-escape"
"<"
(html-escape "<"))
(test "html-tag->string"
"<pre name=\"test\">"
(html-tag->string 'pre '((name . "test"))))
(test-end))
(run-tests)