summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2013-12-07 20:30:44 +0200
committerZahary Karadjov <zahary@gmail.com>2013-12-07 20:30:44 +0200
commit1e26047c3b38349402858ce0a1a5bf747b9f2914 (patch)
tree99e128eb9606b64f81b01d0049e0e89d2c800224 /lib/pure
parenta068aaed3c5ddaf05a104f3f2d0f512bab2861c6 (diff)
downloadNim-1e26047c3b38349402858ce0a1a5bf747b9f2914.tar.gz
adding some provisions for writing lower-level unit tests targeting specific sub-systems of the compiler
see sigmatch as an example.
tests are compiled only when the compiler is compiled with -d:selftest
to execute them, just run the resulting binary without arguments
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/unittest.nim8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim
index 71f4d498b..20f5c610e 100644
--- a/lib/pure/unittest.nim
+++ b/lib/pure/unittest.nim
@@ -98,8 +98,12 @@ template fail* =
 
   when not defined(ECMAScript):
     if AbortOnError: quit(1)
-  
-  TestStatusIMPL = FAILED
+ 
+  when defined(TestStatusIMPL):
+    TestStatusIMPL = FAILED
+  else:
+    program_result += 1
+
   checkpoints = @[]
 
 macro check*(conditions: stmt): stmt {.immediate.} =