]> gitweb.factorcode.org Git - factor.git/blob - extra/html/parser/printer/printer-tests.factor
a2a049f277cf63a9dbd2add36cd4c927ce0a53c2
[factor.git] / extra / html / parser / printer / printer-tests.factor
1 USING:
2     html.parser html.parser.printer
3     io.streams.string
4     namespaces
5     strings
6     tools.test ;
7 IN: html.parser.printer.tests
8
9 {
10     "          "
11 } [
12     5 #indentations [ [ indent ] with-string-writer ] with-variable
13 ] unit-test
14
15 {
16     " href='http://www.google.com' rel='nofollow'"
17 } [
18     H{ { "href" "http://www.google.com" } { "rel" "nofollow" } }
19         [ print-attributes ] with-string-writer
20 ] unit-test
21
22 {
23     "<p>\n  Sup dude!\n  <br>\n</p>\n"
24 } [
25     "<p>Sup dude!<br></p>" parse-html [ prettyprint-html ] with-string-writer
26 ] unit-test
27
28 ! Wrongly nested tags
29 {
30     "<div>\n  <p>\n    Sup dude!\n    <br>\n  </div>\n</p>\n"
31 } [
32     "<div><p>Sup dude!<br></div></p>" parse-html
33     [ prettyprint-html ] with-string-writer
34 ] unit-test