summary refs log tree commit diff stats
path: root/lib/pure/htmlgen.nim
diff options
context:
space:
mode:
authorOleh Prypin <blaxpirit@gmail.com>2015-04-21 15:45:30 +0300
committerOleh Prypin <blaxpirit@gmail.com>2015-04-21 15:59:32 +0300
commit22db40e5e4c1bfb5f2ea3b6864873b2edff30764 (patch)
treee36e74d0ae83467e0879883e277e249d826993a0 /lib/pure/htmlgen.nim
parentc433ae1aaaf9c997281d244bce061470cd55568e (diff)
downloadNim-22db40e5e4c1bfb5f2ea3b6864873b2edff30764.tar.gz
Turn some test outputs into actual tests
Diffstat (limited to 'lib/pure/htmlgen.nim')
-rw-r--r--lib/pure/htmlgen.nim11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/pure/htmlgen.nim b/lib/pure/htmlgen.nim
index bffb33b80..e6c15371e 100644
--- a/lib/pure/htmlgen.nim
+++ b/lib/pure/htmlgen.nim
@@ -482,8 +482,9 @@ macro `var`*(e: expr): expr {.immediate.} =
   let e = callsite()
   result = xmlCheckedTag(e, "var", commonAttr)
 
-when not defined(testing) and isMainModule:
-  var nim = "Nim"
-  echo h1(a(href="http://nim-lang.org", nim))
-  echo form(action="test", `accept-charset` = "Content-Type")
-
+when isMainModule:
+  let nim = "Nim"
+  assert h1(a(href="http://nim-lang.org", nim)) ==
+    """<h1><a href="http://nim-lang.org">Nim</a></h1>"""
+  assert form(action="test", `accept-charset` = "Content-Type") ==
+    """<form action="test" accept-charset="Content-Type"></form>"""