better tester

This commit is contained in:
Araq 2014-01-17 08:47:51 +01:00
commit 383fbca27e
21 changed files with 39 additions and 31 deletions

View file

@ -0,0 +1,12 @@
import macros, typetraits
macro checkType(ex, expected: expr): stmt {.immediate.} =
var t = ex.typ
assert t.name == expected.strVal
proc voidProc = echo "hello"
proc intProc(a, b): int = 10
checkType(voidProc(), "void")
checkType(intProc(10, 20.0), "int")
checkType(noproc(10, 20.0), "Error Type")