when running unit tests, the tester will print only failures using colorless output (this should be better for nimbuild)

This commit is contained in:
Zahary Karadjov
2011-11-10 04:39:46 +02:00
parent 489340658e
commit da4076e0b7
3 changed files with 27 additions and 8 deletions

47
examples/tunit.nim Normal file
View File

@@ -0,0 +1,47 @@
import
unittest, macros
var
a = 1
b = 22
c = 1
d = 3
suite "my suite":
setup:
echo "suite setup"
var testVar = "from setup"
teardown:
echo "suite teardown"
test "first suite test":
testVar = "modified"
echo "test var: " & testVar
check a > b
test "second suite test":
echo "test var: " & testVar
proc foo: bool =
echo "running foo"
return true
proc err =
raise newException(EArithmetic, "some exception")
test "final test":
echo "inside suite-less test"
check:
a == c
foo()
d > 10
test "arithmetic failure":
expect(EArithmetic):
err()
expect(EArithmetic, ESystem):
discard foo()