From: Björn Lindqvist Date: Mon, 5 Aug 2013 11:25:26 +0000 (+0200) Subject: html.parser.printer: unit tests X-Git-Tag: 0.97~1169 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=00f82ae5f07476fa11f586811d72099be7f93568 html.parser.printer: unit tests --- diff --git a/extra/html/parser/printer/printer-tests.factor b/extra/html/parser/printer/printer-tests.factor new file mode 100644 index 0000000000..1d4d676000 --- /dev/null +++ b/extra/html/parser/printer/printer-tests.factor @@ -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 + +[ + "

\n Sup dude!\n
\n

\n" +] [ + "

Sup dude!

" parse-html [ prettyprint-html ] with-string-writer +] unit-test + +! Wrongly nested tags +[ + "
\n

\n Sup dude!\n
\n

\n

\n" +] [ + "

Sup dude!

" parse-html + [ prettyprint-html ] with-string-writer +] unit-test