summary refs log tree commit diff stats
path: root/tests/run/tuserassert.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-12-04 20:14:50 +0100
committerAraq <rumpf_a@web.de>2011-12-04 20:14:50 +0100
commit70cf34cbdcff55771b6936b898fdb87c22af403e (patch)
tree84a1569f0d89e9f0a4b630ef3710675fdc1282d6 /tests/run/tuserassert.nim
parent728328eec2064ed2086b230c09db063268d064fd (diff)
downloadNim-70cf34cbdcff55771b6936b898fdb87c22af403e.tar.gz
'assert' is now implemented without compiler magic
Diffstat (limited to 'tests/run/tuserassert.nim')
-rw-r--r--tests/run/tuserassert.nim14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/run/tuserassert.nim b/tests/run/tuserassert.nim
new file mode 100644
index 000000000..958da2fe1
--- /dev/null
+++ b/tests/run/tuserassert.nim
@@ -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)
+