From 00f82ae5f07476fa11f586811d72099be7f93568 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?=
Date: Mon, 5 Aug 2013 13:25:26 +0200
Subject: [PATCH] html.parser.printer: unit tests
---
.../html/parser/printer/printer-tests.factor | 33 +++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 extra/html/parser/printer/printer-tests.factor
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"
+] [
+ "" parse-html
+ [ prettyprint-html ] with-string-writer
+] unit-test