doctest-prop-0.2.0.1: Allow QuickCheck-style property testing within doctest.

Safe HaskellSafe-Inferred
LanguageHaskell98

Test.DocTest.Prop

Description

This package allows you to write QuickCheck properties and HUnit assertions within doctest, using functions that keep silence when test succeeds and print out the test outputs otherwise.

To enjoy behavior driven development in Haskell, first import Test.DocTest.Prop, and use prop, propWith and unit to write in-place tests, as follows.

>>> import Test.DocTest.Prop
>>> prop $ \x -> x*2 == x+x
>>> prop ((<2) . fromEnum :: Bool -> Bool)
>>> propWith (quietArgs{maxSize=3}) $ (<10).length
>>> assert $ 1+1==2

Synopsis

Documentation

prop :: Testable p => p -> IO () Source

Test the QuickCheck property.

propWith :: Testable p => Args -> p -> IO () Source

prop with customized arguments.

quietArgs :: Args Source

The standard arguments for QuickCheck but the chatty flag is off.