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