html.parser.printer: unit tests

db4
Björn Lindqvist 2013-08-05 13:25:26 +02:00 committed by John Benediktsson
parent aef2e02c0b
commit 00f82ae5f0
1 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,33 @@
USING:
html.parser html.parser.printer
io.streams.string
namespaces
tools.test ;
IN: html.parser.printer.tests
[
" "
] [
[ 5 #indentations set 2 tab-width set tabs ] with-scope
] unit-test
[
" rel='nofollow' href='http://www.google.com'"
] [
H{ { "href" "http://www.google.com" } { "rel" "nofollow" } }
[ print-attributes ] with-string-writer
] unit-test
[
"<p>\n Sup dude!\n <br>\n</p>\n"
] [
"<p>Sup dude!<br></p>" parse-html [ prettyprint-html ] with-string-writer
] unit-test
! Wrongly nested tags
[
"<div>\n <p>\n Sup dude!\n <br>\n </div>\n</p>\n"
] [
"<div><p>Sup dude!<br></div></p>" parse-html
[ prettyprint-html ] with-string-writer
] unit-test