Add support for private tests and captured output

This commit is contained in:
Joey Payne 2019-03-23 14:12:36 -06:00
commit d74374a7cb
4 changed files with 338 additions and 243 deletions

View file

@ -1,6 +1,23 @@
import tani, tables, strutils
import tani, test2
import terminal
import os
test "test 2":
let foo = 100
check(foo < 4)
runTests()
proc foo() =
test "test 2":
let foo = 100
foo()
check(foo < 4)
proc y(): int =
test "y test1":
check y() > 0
test "foo bar":
echo os.joinPath("test", "output")
check y() > 0
checkRaises(Exception):
raise newException(Exception, "Foo Exception")
return 10
runTestsMain()

29
tests/test2.nim Normal file
View file

@ -0,0 +1,29 @@
import tani
type
MyObj* = object
stuff*: int
proc stuff2*(): int =
test "adfsadf":
check stuff2() == 200
return 200
proc testing(): MyObj =
test "my cool test":
check testing().stuff == 200
return MyObj(stuff: 200)
proc stuff() =
test "my cool test":
var x = 20
if x == 20:
echo "hoo"
stuff()
check x == 30
check testing().stuff == 200
echo "hello"
runTests()