hspec- Behavior Driven Development for Haskell

Safe HaskellSafe-Infered



Importing this module allows you to use a QuickCheck property as an example for a behavior. Use the property function to indicate a QuickCkeck property. 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.

 describe "cutTheDeck" [
   it "puts the first half of a list after the last half"
      (property $ \ xs -> let top = take (length xs `div` 2) xs
                              bot = drop (length xs `div` 2) xs
                          in cutTheDeck xs == bot ++ top),

   it "restores an even sized list when cut twice"
      (property $ \ xs -> even (length xs) ==> cutTheDeck (cutTheDeck xs) == xs)



property :: Testable prop => prop -> Property

prop :: Testable t => String -> t -> SpecsSource

Monadic DSL shortcut, use this instead of it