mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-04 21:14:48 +00:00
'assert' is now implemented without compiler magic
This commit is contained in:
14
tests/run/tuserassert.nim
Normal file
14
tests/run/tuserassert.nim
Normal file
@@ -0,0 +1,14 @@
|
||||
discard """
|
||||
output: "454 == 45ugh"
|
||||
"""
|
||||
|
||||
template myAssert(cond: expr) =
|
||||
when rand(3) < 2:
|
||||
let c = cond.astToStr
|
||||
{.warning: "code activated: " & c.}
|
||||
if not cond:
|
||||
echo c, "ugh"
|
||||
|
||||
|
||||
myAssert(454 == 45)
|
||||
|
||||
Reference in New Issue
Block a user