]> gitweb.factorcode.org Git - factor.git/blob - extra/html/parser/printer/printer-tests.factor
dad813dca6d0150c168fab3e640980497e6d5585
[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 set 2 tab-width set tabs >string ] with-scope
13 ] unit-test
14
15 [
16     " rel='nofollow' href='http://www.google.com'"
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