summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
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()