An interpreted, lazy lisp.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

27 lines
766 B

module Rose.Testing
import Test.Unit.Display
import Test.Unit.Generic
export
testWith : List (b -> c) -> List b -> List c
testWith = zipWith apply
export
assertWith : String -> (a -> IO Bool) -> (a -> IO Bool)
assertWith s f =
(\x => putStr (s ++ "\t")
>>= \_ => f x
>>= \b => if b
then (putStrLn "passed\n" >>= \_ => pure b)
else (putStrLn "failed\n" >>= \_ => pure b))
export
runTest : String -> List (IO Bool) -> IO ()
runTest name bs =
putStrLn (heading name)
>>= \_ => sequence bs
>>= pure . all (==True)
>>= \result => if result
then putStrLn (succLine ++ name ++ " passed")
else putStrLn (errLine ++ name ++ " failed")