unittest module compiles again
This commit is contained in:
parent
7fd8f285d0
commit
e3b25e93ac
2 changed files with 6 additions and 6 deletions
|
|
@ -93,8 +93,8 @@ template fail* =
|
||||||
checkpoints = @[]
|
checkpoints = @[]
|
||||||
|
|
||||||
macro check*(conditions: stmt): stmt =
|
macro check*(conditions: stmt): stmt =
|
||||||
proc standardRewrite(e: expr): stmt =
|
proc standardRewrite(e: PNimrodNode): PNimrodNode =
|
||||||
template rewrite(Exp, lineInfoLit: expr, expLit: string): stmt =
|
template rewrite(Exp, lineInfoLit: expr, expLit: string): PNimrodNode =
|
||||||
if not Exp:
|
if not Exp:
|
||||||
checkpoint(lineInfoLit & ": Check failed: " & expLit)
|
checkpoint(lineInfoLit & ": Check failed: " & expLit)
|
||||||
fail()
|
fail()
|
||||||
|
|
@ -105,9 +105,9 @@ macro check*(conditions: stmt): stmt =
|
||||||
of nnkCall, nnkCommand, nnkMacroStmt:
|
of nnkCall, nnkCommand, nnkMacroStmt:
|
||||||
case conditions[1].kind
|
case conditions[1].kind
|
||||||
of nnkInfix:
|
of nnkInfix:
|
||||||
proc rewriteBinaryOp(op: expr): stmt =
|
proc rewriteBinaryOp(op: PNimrodNode): PNimrodNode =
|
||||||
template rewrite(op, left, right, lineInfoLit: expr, opLit,
|
template rewrite(op, left, right, lineInfoLit: expr, opLit,
|
||||||
leftLit, rightLit: string, printLhs, printRhs: bool): stmt =
|
leftLit, rightLit: string, printLhs, printRhs: bool): PNimrodNode =
|
||||||
block:
|
block:
|
||||||
var
|
var
|
||||||
lhs = left
|
lhs = left
|
||||||
|
|
@ -152,7 +152,7 @@ template require*(conditions: stmt): stmt =
|
||||||
check conditions
|
check conditions
|
||||||
|
|
||||||
macro expect*(exp: stmt): stmt =
|
macro expect*(exp: stmt): stmt =
|
||||||
template expectBody(errorTypes, lineInfoLit: expr, body: stmt): stmt =
|
template expectBody(errorTypes, lineInfoLit: expr, body: stmt): PNimrodNode =
|
||||||
try:
|
try:
|
||||||
body
|
body
|
||||||
checkpoint(lineInfoLit & ": Expect Failed, no exception was thrown.")
|
checkpoint(lineInfoLit & ": Expect Failed, no exception was thrown.")
|
||||||
|
|
|
||||||
|
|
@ -2220,7 +2220,7 @@ type
|
||||||
|
|
||||||
template eval*(blk: stmt): stmt =
|
template eval*(blk: stmt): stmt =
|
||||||
## executes a block of code at compile time just as if it was a macro
|
## executes a block of code at compile time just as if it was a macro
|
||||||
## optonally, the block can return an AST tree that will replace the
|
## optionally, the block can return an AST tree that will replace the
|
||||||
## eval expression
|
## eval expression
|
||||||
block:
|
block:
|
||||||
macro payload(x: stmt): stmt = blk
|
macro payload(x: stmt): stmt = blk
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue