Safe Haskell | Safe-Infered |
---|
Importing this module allows you to use an HUnit
Test
as an example
for a behavior. You can use an explicit TestCase
data constructor or
use an Assertion
. For an Assertion
, any exception means the example
failed; otherwise, it's successfull.
NOTE: Any output from the example to stdout
is ignored. If you need to
write out for debugging, you can write to stderr
or a file handle.
import Test.Hspec.Monadic import Test.Hspec.HUnit () import Test.HUnit main :: IO () main = hspecX $ do describe "reverse" $ do it "reverses a list" $ do reverse [1, 2, 3] @?= [3, 2, 1] it "gives the original list, if applied twice" $ TestCase $ (reverse . reverse) [1, 2, 3] @?= [1, 2, 3]