summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorfenekku <fenekku@fenekku.com>2015-07-09 13:22:26 -0400
committerfenekku <fenekku@fenekku.com>2015-07-09 13:22:26 -0400
commit464ec61e9c11deb1a52df431a266ba50bf132304 (patch)
tree1ac53b7c4ca2dec3a2221b83cf0c3d33dbcf95e1 /tests
parent7aa227ba79b6b363ab4b75a2b16ad1d60f51e49a (diff)
downloadNim-464ec61e9c11deb1a52df431a266ba50bf132304.tar.gz
document unittest.nim + code agreement
Diffstat (limited to 'tests')
-rw-r--r--tests/stdlib/tunittest.nim14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/stdlib/tunittest.nim b/tests/stdlib/tunittest.nim
index b23b3cdab..fb9b02243 100644
--- a/tests/stdlib/tunittest.nim
+++ b/tests/stdlib/tunittest.nim
@@ -19,3 +19,17 @@ import options
 test "unittest typedescs":
   check(none(int) == none(int))
   check(none(int) != some(1))
+
+
+import math
+from strutils import parseInt
+proc defectiveRobot() =
+  randomize()
+  case random(1..4)
+  of 1: raise newException(OSError, "CANNOT COMPUTE!")
+  of 2: discard parseInt("Hello World!")
+  of 3: raise newException(IOError, "I can't do that Dave.")
+  else: assert 2 + 2 == 5
+test "unittest expect":
+  expect IOError, OSError, ValueError, AssertionError:
+    defectiveRobot()