hspec-leancheck: LeanCheck support for the Hspec test framework.

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

LeanCheck support for the Hspec test framework.

This package can be used to incorporate LeanCheck tests into Hspec test suites by means of the Test.Hspec.LeanCheck.testProperty function.

Please see the Haddock documentation and README for more details.


[Skip to ReadMe]

Properties

Versions0.0.1, 0.0.1, 0.0.2
Change logNone available
Dependenciesbase (==4.*), hspec (>=2.5), hspec-core, HUnit, leancheck [details]
LicenseBSD-3-Clause
AuthorRudy Matela <rudy@matela.com.br>
MaintainerRudy Matela <rudy@matela.com.br>
CategoryTesting
Home pagehttps://github.com/rudymatela/hspec-leancheck#readme
Source repositoryhead: git clone https://github.com/rudymatela/hspec-leancheck
this: git clone https://github.com/rudymatela/hspec-leancheck(tag v0.0.1)
UploadedSat Sep 8 15:18:33 UTC 2018 by rudymatela

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees


Readme for hspec-leancheck-0.0.1

[back to package description]

hspec-leancheck: LeanCheck support for Hspec

hspec-leancheck&#39;s Build Status hspec-leancheck on Hackage hspec-leancheck on Stackage LTS hspec-leancheck on Stackage Nightly

LeanCheck support for the Hspec test framework.

Installing

$ cabal install hspec-leancheck

Example

Here's how your spec.hs might look like:

import Test.Hspec
import Test.Hspec.LeanCheck as LC

import Data.List (sort)

main :: IO ()
main = hspec spec

spec :: Spec
spec = do
  describe "sort" $ do
    it "is idempotent" $
      LC.property $ \xs -> sort (sort xs :: [Int]) == sort xs
    it "is identity" $ -- not really
      LC.property $ \xs -> sort (xs :: [Int]) == xs

And here is the output for the above program:

$ ./eg/minimal

sort
  is idempotent
  is identity FAILED [1]

Failures:

  eg/minimal.hs:17:5: 
  1) sort is identity
       [1,0]

  To rerun use: --match "/sort/is identity/"

Randomized with seed 44182769

Finished in 0.0008 seconds
2 examples, 1 failure

Options

Use propertyWith to configure the number of tests.

Further reading