summary refs log tree commit diff stats
path: root/lib/pure/unittest.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-10-05 12:10:01 +0200
committerAraq <rumpf_a@web.de>2012-10-05 12:10:01 +0200
commit350e178d837a212755b729bb82225193acef5734 (patch)
treebd94d64c55eeccdf8479c967bc77bac2500336af /lib/pure/unittest.nim
parent01dfcf63106fb18239a1c6dabf551405c33b6e7e (diff)
parentf28b7be6a37d566df64cb944c1687e014be8d083 (diff)
downloadNim-350e178d837a212755b729bb82225193acef5734.tar.gz
Merge branch 'master' of github.com:Araq/Nimrod
Diffstat (limited to 'lib/pure/unittest.nim')
-rw-r--r--lib/pure/unittest.nim11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim
index 0233b8bac..fce84bea4 100644
--- a/lib/pure/unittest.nim
+++ b/lib/pure/unittest.nim
@@ -151,7 +151,7 @@ template require*(conditions: stmt): stmt {.immediate, dirty.} =
     const AbortOnError {.inject.} = true
     check conditions
 
-macro expect*(exp: stmt): stmt {.immediate.} =
+macro expect*(exceptions: varargs[expr], body: stmt): stmt {.immediate.} =
   let exp = callsite()
   template expectBody(errorTypes, lineInfoLit: expr,
                       body: stmt): PNimrodNode {.dirty.} =
@@ -162,12 +162,11 @@ macro expect*(exp: stmt): stmt {.immediate.} =
     except errorTypes:
       nil
 
-  var expectCall = exp[0]
-  var body = exp[1]
-  
+  var body = exp[exp.len - 1]
+
   var errorTypes = newNimNode(nnkBracket)
-  for i in countup(1, expectCall.len - 1):
-    errorTypes.add(expectCall[i])
+  for i in countup(1, exp.len - 2):
+    errorTypes.add(exp[i])
 
   result = getAst(expectBody(errorTypes, exp.lineinfo, body))