document unittest.nim + code agreement

This commit is contained in:
fenekku
2015-07-09 13:22:26 -04:00
parent 7aa227ba79
commit 464ec61e9c
2 changed files with 145 additions and 13 deletions

View File

@@ -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()