summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2013-12-09 00:09:03 +0200
committerZahary Karadjov <zahary@gmail.com>2013-12-09 00:09:03 +0200
commitde3b7cd413e02498c0ee5554f55f9c92d2baa9ab (patch)
tree0ce3f72d36fcc09a48b12f7e04a5f7e633da9a18 /lib
parent208924b92921ea10afc27dbab059e612113eee48 (diff)
downloadNim-de3b7cd413e02498c0ee5554f55f9c92d2baa9ab.tar.gz
progress towards adding negative type classes
[unittest bugfixes]
the block form of check now allows comments
errors when inspecting the arguments of var-accepting procs
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/unittest.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim
index 20f5c610e..f847d24f4 100644
--- a/lib/pure/unittest.nim
+++ b/lib/pure/unittest.nim
@@ -115,7 +115,8 @@ macro check*(conditions: stmt): stmt {.immediate.} =
     counter = 0
 
   template asgn(a, value: expr): stmt =
-    let a = value
+    var a = value # XXX: we need "var: var" here in order to
+                  # preserve the semantics of var params
   
   template print(name, value: expr): stmt =
     when compiles(string($value)):
@@ -150,7 +151,8 @@ macro check*(conditions: stmt): stmt {.immediate.} =
   of nnkStmtList:
     result = newNimNode(nnkStmtList)
     for i in countup(0, checked.len - 1):
-      result.add(newCall(!"check", checked[i]))
+      if checked[i].kind != nnkCommentStmt:
+        result.add(newCall(!"check", checked[i]))
 
   else:
     template rewrite(Exp, lineInfoLit: expr, expLit: string): stmt =